This patch by Chris Manghane fixes the Go frontend to check for EOF
when parsing a function signature.  This avoids an infinite loop on an
invalid program, and fixes https://golang.org/issue/11530 and
https://golang.org/issue/11531 .  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 226794)
+++ gcc/go/gofrontend/MERGE     (working copy)
@@ -1,4 +1,4 @@
-3b590ff53700963c1b8207a78594138e6a4e47f4
+55175f7ee0db2c1e68423216d7744be80071ed6c
 
 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 226529)
+++ gcc/go/gofrontend/parse.cc  (working copy)
@@ -1045,7 +1045,8 @@ Parse::parameter_decl(bool parameters_ha
            {
              *mix_error = true;
              while (!this->peek_token()->is_op(OPERATOR_COMMA)
-                    && !this->peek_token()->is_op(OPERATOR_RPAREN))
+                    && !this->peek_token()->is_op(OPERATOR_RPAREN)
+                     && !this->peek_token()->is_eof())
                this->advance_token();
            }
        }

Reply via email to