Patchwork [gccgo] Avoid crash on error

login
register
mail settings
Submitter Ian Taylor
Date Oct. 22, 2010, 10:01 p.m.
Message ID <mcreibhx4xo.fsf@google.com>
Download mbox | patch
Permalink /patch/68981/
State New
Headers show

Comments

Ian Taylor - Oct. 22, 2010, 10:01 p.m.
This gccgo patch avoids a crash when generating the type descriptor of
an erroneous type.  Committed to gccgo branch.

Ian

Patch

diff -r bbbe54463c27 go/gogo-tree.cc
--- a/go/gogo-tree.cc	Fri Oct 22 14:31:46 2010 -0700
+++ b/go/gogo-tree.cc	Fri Oct 22 15:00:13 2010 -0700
@@ -2558,6 +2558,11 @@ 
 						name->in_function());
   tree id = get_identifier_from_string(decl_name);
   tree descriptor_type_tree = initializer->type()->get_tree(this);
+  if (descriptor_type_tree == error_mark_node)
+    {
+      *pdecl = error_mark_node;
+      return;
+    }
   tree decl = build_decl(name == NULL ? BUILTINS_LOCATION : name->location(),
 			 VAR_DECL, id,
 			 build_qualified_type(descriptor_type_tree,