From 12db282451124fdb2e37936dc80a4c583ab7f56c Mon Sep 17 00:00:00 2001 From: ian Date: Mon, 7 May 2012 18:53:44 +0000 Subject: [PATCH] compiler: fix an ICE when parsing 0xdie, reject token 0x123i. The lexer used to incorrectly accept a token like 0x123i and interpreted it as 123i. It also used to die when encountering 0xdie. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@187267 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/lex.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/go/gofrontend/lex.cc b/gcc/go/gofrontend/lex.cc index 53618fc72ca..5b7ce6869e6 100644 --- a/gcc/go/gofrontend/lex.cc +++ b/gcc/go/gofrontend/lex.cc @@ -1012,7 +1012,9 @@ Lex::gather_number() } } - if (*p != '.' && *p != 'i' && !Lex::could_be_exponent(p, pend)) + // A partial token that looks like an octal literal might actually be the + // beginning of a floating-point or imaginary literal. + if (base == 16 || (*p != '.' && *p != 'i' && !Lex::could_be_exponent(p, pend))) { std::string s(pnum, p - pnum); mpz_t val; -- 2.11.0