OSDN Git Service

Don't crash building map descriptor for erroneous map.
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Dec 2010 01:22:32 +0000 (01:22 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Dec 2010 01:22:32 +0000 (01:22 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168197 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/go/gofrontend/gogo-tree.cc

index a5fb5f6..05a701f 100644 (file)
@@ -2356,6 +2356,8 @@ Gogo::map_descriptor(Map_type* maptype)
   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 @@ Gogo::map_descriptor(Map_type* maptype)
                                        "__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)),