optimization/4077: -fshort-enums makes enumerations behave like unsigned int not int

rth@gcc.gnu.org rth@gcc.gnu.org
Tue Apr 2 20:14:00 GMT 2002


Synopsis: -fshort-enums makes enumerations behave like unsigned int not int

State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Tue Apr  2 20:05:20 2002
State-Changed-Why:
    Not a bug.  With -fshort-enums, enumerations with no negative
    values are represented with a type compatible with unsigned short.
    
    The semantics of ((unsigned short)-1) == -1, is that the
    arithmetic conversions are applied.  For targets in which
    sizeof(short) < sizeof(int) holds true, the promoted type
    is int, and we compare a zero-extended version of the short
    (i.e. 0xffff == -1 for most targets).
    
    Which is of course going to be false.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=4077



More information about the Gcc-bugs mailing list