]> gcc.gnu.org Git - gcc.git/commitdiff
compiler: fix an ICE when parsing 0xdie, reject token 0x123i.
authorIan Lance Taylor <ian@gcc.gnu.org>
Mon, 7 May 2012 18:53:28 +0000 (18:53 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Mon, 7 May 2012 18:53:28 +0000 (18:53 +0000)
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

index 53618fc72cad178a30f97cdcfaf84d077819ac0d..5b7ce6869e6c641284983d3505c1f247d985040d 100644 (file)
@@ -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;
This page took 0.063953 seconds and 5 git commands to generate.