Patchwork Go patch committed: Don't patch if type was not converted

login
register
mail settings
Submitter Ian Taylor
Date March 3, 2011, 6:50 a.m.
Message ID <mcr7hcg3dfn.fsf@google.com>
Download mbox | patch
Permalink /patch/85237/
State New
Headers show

Comments

Ian Taylor - March 3, 2011, 6:50 a.m.
This patch to the Go frontend avoids a crash if an erroneous type was
not converted to GENERIC.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

Patch

diff -r afb3d3196225 go/types.cc
--- a/go/types.cc	Wed Mar 02 22:39:25 2011 -0800
+++ b/go/types.cc	Wed Mar 02 22:46:54 2011 -0800
@@ -7300,7 +7300,12 @@ 
 
   // We are not converting types.  This should only be called if the
   // type has already been converted.
-  gcc_assert(this->is_converted_);
+  if (!this->is_converted_)
+    {
+      gcc_assert(saw_errors());
+      return error_mark_node;
+    }
+
   gcc_assert(t != NULL_TREE && TYPE_SIZE(t) != NULL_TREE);
 
   // Complete the tree.