From 62beea506bd1a5c688e7b88457408411c8272635 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor <ian@gcc.gnu.org> Date: Mon, 7 May 2012 18:53:28 +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. From-SVN: r187266 --- 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 53618fc72cad..5b7ce6869e6c 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; -- GitLab