diff mbox

Go patch committed: Don't crash on erroneous array return types

Message ID CAOyqgcVLoy9s+weqRjp1x_COqxwm0d6KOAw8b69y3c2Uv7p5wg@mail.gmail.com
State New
Headers show

Commit Message

Ian Lance Taylor Jan. 27, 2016, 12:01 a.m. UTC
This patch by Chris Manghane avoids a Go frontend crash on an
erroneous array return type.  This fixes
https://golang.org/issue/12939.  Bootstrapped and ran Go testsuite on
x86_64-pc-linux-gnu.  Committed to mainline.

Ian
diff mbox

Patch

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 232857)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@ 
-721c778adb8f99d8a6b7795dbad86013ccc9ba91
+9e68d67d65fd72b9b4f163f2f26e15cd0d3e2cd2
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: gcc/go/gofrontend/parse.cc
===================================================================
--- gcc/go/gofrontend/parse.cc	(revision 232239)
+++ gcc/go/gofrontend/parse.cc	(working copy)
@@ -419,6 +419,8 @@  Parse::array_type(bool may_use_ellipsis)
     }
 
   Type* element_type = this->type();
+  if (element_type->is_error_type())
+    return Type::make_error_type();
 
   return Type::make_array_type(element_type, length);
 }