gcc bug WRT warning that should not be displayed
Jim Wilson
wilson@specifix.com
Mon Mar 19 19:56:00 GMT 2007
Mo DeJong wrote:
> long val2 = 1; /* incorrect warn when val2 is a long */
> int c2 = (
> ((long long) val2) <
> ((long long)(-2147483647L - 1))
> );
The result of the compare will always be false, so the warning is correct.
The long variable val2 can not hold a value smaller than LONG_MIN.
Adding casts to long long does not change this fact.
--
Jim Wilson, GNU Tools Support, http://www.specifix.com
More information about the Gcc-bugs
mailing list