[cfe-dev] SwitchStmt cond type and EnumConstantDecl type problems

Chris Lattner clattner at apple.com
Wed Feb 3 12:40:23 PST 2010


On Feb 3, 2010, at 11:43 AM, Sebastian Redl wrote:

> Douglas Gregor wrote:
>> Actually, I take that back: there may not be a bug here :)
>>
>> GCC 4.2 on my platform has Z=4294967286, unless you compile with "- 
>> pedantic", in which case it complains and then has Z=-10.
>>
> Huh, I thought GCC's -pedantic is only about warnings, not behavior.

There is a fixme in GCC's code about this exact case:

tree
build_enumerator (tree name, tree value)
{
...
  if (pedantic && !int_fits_type_p (value, integer_type_node))
     {
       pedwarn ("ISO C restricts enumerator values to range of %<int 
%>");
       /* XXX This causes -pedantic to change the meaning of the  
program.
          Remove?  -zw 2004-03-15  */
       value = convert (integer_type_node, value);
     }

-Chris



More information about the cfe-dev mailing list