This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Go patch committed: Don't crash building map descriptor for bad map
- 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: Wed, 22 Dec 2010 17:22:34 -0800
- Subject: Go patch committed: Don't crash building map descriptor for bad map
This patch to the Go frontend avoids crashing when building the map
descriptor for an invalid map type. Bootstrapped and ran Go testsuite
on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
diff -r 0d3685934321 go/gogo-tree.cc
--- a/go/gogo-tree.cc Wed Dec 22 17:00:12 2010 -0800
+++ b/go/gogo-tree.cc Wed Dec 22 17:16:42 2010 -0800
@@ -2356,6 +2356,8 @@
Map_descriptors::iterator p = ins.first;
if (!ins.second)
{
+ if (p->second == error_mark_node)
+ return error_mark_node;
gcc_assert(p->second != NULL_TREE && DECL_P(p->second));
return build_fold_addr_expr(p->second);
}
@@ -2385,7 +2387,10 @@
"__val",
valtype->get_tree(this));
if (map_entry_type == error_mark_node)
- return error_mark_node;
+ {
+ p->second = error_mark_node;
+ return error_mark_node;
+ }
tree map_entry_key_field = DECL_CHAIN(TYPE_FIELDS(map_entry_type));
gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(map_entry_key_field)),