[Bug c/97884] INT_MIN falsely expanded to 64 bit
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Nov 18 17:03:34 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97884
--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to s.bauroth from comment #7)
> > The type of an integer constant is the first of the corresponding list
> > in which its value can be represented.
> These kind of sentences make me think gcc's behaviour is wrong. The number
> can be represented in 32 bits.
No it can't.
A few paragraphs above the text I quoted last time it says:L
"An integer constant begins with a digit, but has no period or exponent part.
It may have a prefix that specifies its base and a suffix that specifies its
type."
So the - sign is not part of the constant. The constant is 2147483648 and that
doesn't fit in 32 bits. So it's a 64-bit type, and then that gets negated.
That has been explained several times now.
"I don't understand C and I won't read the spec" is not a GCC bug.
More information about the Gcc-bugs
mailing list