diff mbox

Go patch committed: fix crash on invalid program

Message ID CAOyqgcU9CA-tQ0aB_+NhQ6d8yZRG+6dfZogBCiVyN8h7Yrst9w@mail.gmail.com
State New
Headers show

Commit Message

Ian Lance Taylor Dec. 8, 2014, 6:05 p.m. UTC
This patch from Chris Manghane fixes a crash-on-invalid in the Go
frontend.  This is GCC PR 64198.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian
diff mbox

Patch

diff -r 2a85649c19e1 go/parse.cc
--- a/go/parse.cc	Sun Nov 30 17:28:00 2014 -0800
+++ b/go/parse.cc	Mon Dec 08 10:01:38 2014 -0800
@@ -3190,9 +3190,12 @@ 
   if (token->is_op(OPERATOR_COMMA))
     token = this->advance_token();
   if (!token->is_op(OPERATOR_RPAREN))
-    error_at(this->location(), "missing %<)%>");
-  else
-    this->advance_token();
+    {
+      error_at(this->location(), "missing %<)%>");
+      if (!this->skip_past_error(OPERATOR_RPAREN))
+	return Expression::make_error(this->location());
+    }
+  this->advance_token();
   if (func->is_error_expression())
     return func;
   return Expression::make_call(func, args, is_varargs, func->location());