This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gccgo] Avoid crash on error
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org, gofrontend-dev at googlegroups dot com
- Date: Fri, 22 Oct 2010 15:01:39 -0700
- Subject: [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,