https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101254
Bug ID: 101254
Summary: gcc head does not comply fully to -fwrapv
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: bugzilla.gnu at coelho dot net
Target Milestone: ---
Created attachment 51079
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51079&action=edit
source file for above test
-fwrapv does not work as expected on gcc head:
Previous expected behavior :
sh> gcc --version
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
sh> gcc -O2 -fwrapv gcc_overflow.c
sh> ./a.out
1: 1
0: 0
0: 0
Behavior with head:
sh> gcc --version
gcc (GCC) 12.0.0 20210627 (461f937b)
sh> gcc -O2 -fwrapv gcc_overflow.c
sh> ./a.out
1: 1
0: 0
0: 1
But with the same :
sh> gcc -O1 -fwrapv gcc_overflow.c
sh> ./a.out
1: 1
0: 0
0: 0
Not that it seems that it was working fine with bc046a60 on 2021-06-18, so the
regression may have been introduced after this date.