https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97884

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The C standard says "The type of an integer constant is the first of the
corresponding list in which its value can be represented." The corresponding
list for decimal constants with no suffix is int, long int, long long int.

Since 2147483647 doesn't fit in int, it will have a larger type (long long int
for your target). The unary - operator changes the value, but it still has type
long long int.

If you use INT_MIN from <limits.h> it will work, because that's defined as
(-INT_MAX - 1) as Richard and Jakub said. It's defined like that for a good
reason.

Reply via email to