diff --git a/gcc/go/gofrontend/lex.cc b/gcc/go/gofrontend/lex.cc index 53618fc72cad178a30f97cdcfaf84d077819ac0d..5b7ce6869e6c641284983d3505c1f247d985040d 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;