This patch by Chris Manghane to the Go frontend avoids a compiler
crash on an initialization error involving builtin functions.  This
fixes https://golang.org/issue/12319 .  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE     (revision 227811)
+++ gcc/go/gofrontend/MERGE     (working copy)
@@ -1,4 +1,4 @@
-eac8b31fec761c8da0606a70ae0547ff0b12e8db
+01a574c1b2bb244be764b6a18aab980ca0aef43c
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: gcc/go/gofrontend/expressions.cc
===================================================================
--- gcc/go/gofrontend/expressions.cc    (revision 227758)
+++ gcc/go/gofrontend/expressions.cc    (working copy)
@@ -6885,11 +6885,6 @@ Builtin_call_expression::do_flatten(Gogo
                                     Statement_inserter* inserter)
 {
   Location loc = this->location();
-  if (this->is_erroneous_call())
-    {
-      go_assert(saw_errors());
-      return Expression::make_error(loc);
-    }
 
   switch (this->code_)
     {
@@ -8064,6 +8059,13 @@ Builtin_call_expression::do_get_backend(
 {
   Gogo* gogo = context->gogo();
   Location location = this->location();
+
+  if (this->is_erroneous_call())
+    {
+      go_assert(saw_errors());
+      return gogo->backend()->error_expression();
+    }
+
   switch (this->code_)
     {
     case BUILTIN_INVALID:

Reply via email to