[Bug c/44272] New: Wrong interpretation of hex constant as floating point value.

draqsn at mail dot ru gcc-bugzilla@gcc.gnu.org
Tue May 25 14:47:00 GMT 2010


gcc 4.5.0, built for arm-elf
Problems with compiling following code:

int ret_const(void)
{
    return 0x12E+2;
}

GCC claims that:

test.c: In function 'ret_const':
test.c:3:12: error: invalid suffix "+2" on integer constant
test.c:4:1: warning: control reaches end of non-void function

This is because GCC thinks that 0x12E+2 is a floating point number, while this
is just an addition of two integers.
Adding spaces around '+' solves the problem, but this is definitely bug.
It persists with all versions of GCC 4.4.x and 4.5.0


-- 
           Summary: Wrong interpretation of hex constant as floating point
                    value.
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: draqsn at mail dot ru
 GCC build triplet: all
  GCC host triplet: all
GCC target triplet: all


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



More information about the Gcc-bugs mailing list