[Bug target/30484] INT_MIN % -1 is well defined for -fwrapv
vincent-gcc at vinc17 dot net
gcc-bugzilla@gcc.gnu.org
Tue Aug 24 08:49:51 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30484
--- Comment #19 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
(In reply to rguenther@suse.de from comment #17)
> True. The user could have written the following though:
>
> int f (int a, int b, int c)
> {
> return (unsigned)a + b + c;
> }
This code is incorrect, as based on an implementation-defined behavior.
> or alternatively
>
> int f (int a, int b, int c)
> {
> return (long)a + b + c;
> }
This code is incorrect, and it may yield an integer overflow when long = int,
e.g. on 32-bit processors.
More information about the Gcc-bugs
mailing list