Bug 33547 - invalid suffix "+0x23" on integer constant
Summary: invalid suffix "+0x23" on integer constant
Status: RESOLVED DUPLICATE of bug 3885
Alias: None
Product: gcc
Classification: Unclassified
Component: preprocessor (show other bugs)
Version: 4.1.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-24 20:03 UTC by Joerg Wunsch
Modified: 2022-06-20 20:31 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joerg Wunsch 2007-09-24 20:03:09 UTC
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.
Comment 1 Andreas Schwab 2007-09-24 21:13:00 UTC
0x4E+0x23 is a single preprocessing number.  If that cannot be turned into a valid token then the program is malformed.  Put in some space.
Comment 2 Andreas Schwab 2010-08-04 16:40:49 UTC
*** Bug 45184 has been marked as a duplicate of this bug. ***
Comment 3 Andrew Pinski 2022-06-20 20:31:47 UTC
Dup of bug 3885.

*** This bug has been marked as a duplicate of bug 3885 ***