[Bug c/126003] integer overflow during compile-time arithmetic is not always detected
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Jun 27 00:07:36 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126003
--- Comment #3 from Drea Pinski <pinskia at gcc dot gnu.org> ---
> According to the syntax of the C23 standard, neither is parsed as a constant expression.
Huh?
`TWOGIG + TWOGIG` is one because TWOGIG is a macro that gets subsituted to
`2000000000`
That is why:
int x = TWOGIG+TWOGIG;
is allowed be compiled in the first place, since global variables require
constant expressions for their initilizer.
More information about the Gcc-bugs
mailing list