diff mbox

Go patch committed: Fix C-style comment parsing

Message ID mcrsimbeft2.fsf@iant-glaptop.roam.corp.google.com
State New
Headers show

Commit Message

Ian Lance Taylor July 8, 2014, 8:50 p.m. UTC
PR 61746 and gofrontend issue 35 point out a bug in C-style comment
parsing in the Go frontend.  The sequence /*/ was interpreted as a
complete C-style comment.  This patch fixes the bug.  Bootstrapped and
ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to mainline and
4.9 branch.

Ian
diff mbox

Patch

diff -r 5d0434c2007e go/lex.cc
--- a/go/lex.cc	Wed Jul 02 07:22:05 2014 -0700
+++ b/go/lex.cc	Tue Jul 08 13:41:25 2014 -0700
@@ -598,7 +598,7 @@ 
 		}
 	      else if (p[1] == '*')
 		{
-		  this->lineoff_ = p - this->linebuf_;
+		  this->lineoff_ = p + 2 - this->linebuf_;
 		  Location location = this->location();
 		  if (!this->skip_c_comment())
 		    return Token::make_invalid_token(location);