[Bug preprocessor/33547] New: invalid suffix "+0x23" on integer constant

j at uriah dot heep dot sax dot de gcc-bugzilla@gcc.gnu.org
Mon Sep 24 20:03:00 GMT 2007


Compiling the following simple snippet:

void foo(void)
{
        int i = 0x4E+0x23;
}

triggers the error message indicated in the summary.

Analysis of the problem shows that the macro VALID_SIGN() used inside
lex_number() (libcpp/lex.c) misidentifiex the plus sign following the
E (possible exponent) character as still being part of the number, even
though this is impossible since the number started with 0x, so the
exponent is required to be introduced with `p' or `P'.

IMHO, the number parser needs to detect the possible 0x prefix early,
and pass this information down to VALID_SIGN() so this macro can
definately decide whether either of `p' or `e' is the valid exponent
character within the current context.


-- 
           Summary: invalid suffix "+0x23" on integer constant
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: j at uriah dot heep dot sax dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33547



More information about the Gcc-bugs mailing list