aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-05-07 18:53:28 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-05-07 18:53:28 +0000
commit62beea506bd1a5c688e7b88457408411c8272635 (patch)
tree7095bb5f9bbc868f8efa84c16ab0286fe5aa1fec /gcc/go
parentca30ba74c97fac7fa2c9da54a3bc45bda11bfd2c (diff)
downloadgcc-62beea506bd1a5c688e7b88457408411c8272635.zip
gcc-62beea506bd1a5c688e7b88457408411c8272635.tar.gz
gcc-62beea506bd1a5c688e7b88457408411c8272635.tar.bz2
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. From-SVN: r187266
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/lex.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/lex.cc b/gcc/go/gofrontend/lex.cc
index 53618fc..5b7ce68 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;