[Bug testsuite/31290] gcc.c-torture/execute/920612-1.c and gcc.c-torture/execute/920711-1.c depend on signed overflow being defined

pkk at spth dot de gcc-bugzilla@gcc.gnu.org
Tue Aug 30 07:08:26 GMT 2022


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

Philipp <pkk at spth dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pkk at spth dot de

--- Comment #4 from Philipp <pkk at spth dot de> ---
I disagree about this bug for gcc.c-torture/execute/920711-1.c. I think there
was no bug here, and the "fix" actually introduced a problem, and should be
reverted:

I do not see signed integer overflow here:

f (0x80000000L)

Unless explicitly noted otherwise, all section numbers in the following refer
to the C2X standard draft N3047.

The 0x80000000L might be outside the range of long (i.e. on systems where long
has 32 bits). In that case, it will have type long long, as per the table in
section 6.4.4.1. Since the argument to f is of type long, it will get converted
to type long. That is not undefined, but implementation-defined according to
section 6.3.1.3.
By section 4.5 of the GCC manual
https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html#Integers-implementation
the result of the conversion is -1.


More information about the Gcc-bugs mailing list