This patch from Chris Manghane fixes the Go frontend to not crash
after parsing a malformed receiver or parameter. This fixes
https://golang.org/issue/11576 . 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 226184)
+++ gcc/go/gofrontend/MERGE (working copy)
@@ -1,4 +1,4 @@
-46117382a58843af60fc2feab68c433a96f79e79
+e4a5e2b2a9dc556685db09421a95871f195f768b
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 226123)
+++ gcc/go/gofrontend/parse.cc (working copy)
@@ -787,9 +787,11 @@ Parse::parameters(Typed_identifier_list*
// The optional trailing comma is picked up in parameter_list.
if (!token->is_op(OPERATOR_RPAREN))
- error_at(this->location(), "expected %<)%>");
- else
- this->advance_token();
+ {
+ error_at(this->location(), "expected %<)%>");
+ return false;
+ }
+ this->advance_token();
if (saw_error)
return false;