Don't crash on bad receiver when building recover thunks.
authorIan Lance Taylor <ian@gcc.gnu.org>
Thu, 24 Feb 2011 02:51:00 +0000 (02:51 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Thu, 24 Feb 2011 02:51:00 +0000 (02:51 +0000)
From-SVN: r170452

gcc/go/gofrontend/gogo.cc

index f1404cc260ef32ba1fc3bfd6b301ad9c571a7dc4..a63abfefde3806805c64d968f646874c8bc35e81 100644 (file)
@@ -2205,10 +2205,14 @@ Build_recover_thunks::function(Named_object* orig_no)
 
       const std::string& new_receiver_name(orig_fntype->receiver()->name());
       Named_object* new_rec_no = new_bindings->lookup_local(new_receiver_name);
-      gcc_assert(new_rec_no != NULL
-                && new_rec_no->is_variable()
-                && new_rec_no->var_value()->is_receiver());
-      new_rec_no->var_value()->set_is_not_receiver();
+      if (new_rec_no == NULL)
+       gcc_assert(saw_errors());
+      else
+       {
+         gcc_assert(new_rec_no->is_variable()
+                    && new_rec_no->var_value()->is_receiver());
+         new_rec_no->var_value()->set_is_not_receiver();
+       }
     }
 
   // Because we flipped blocks but not types, the can_recover