This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gccgo] Avoid crash on error


This gccgo patch avoids a crash when generating the type descriptor of
an erroneous type.  Committed to gccgo branch.

Ian

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,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]