http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58454
Bug ID: 58454
Summary: Potentially wrong(or at least weird/inconsistent) code
generation with -O2 -fno-strict-overflow
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: mednafen at gmail dot com
Created attachment 30844
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30844&action=edit
Testcase program.
Working:
XXX@willow:~/halt$ /usr/local/gcc-4.8.1/bin/gcc -Wall -O0 -o halt halt.c
XXX@willow:~/halt$ ./halt
IMm3: ****
IMm2: ***
IMm1: **
IM: *
????:
XXX@willow:~/halt$ /usr/local/gcc-4.8.1/bin/gcc -Wall -O2 -o halt halt.c
XXX@willow:~/halt$ ./halt
IMm3: ****IMm3: ****IMm3: ****IMm3: ****IMm3: ****IMm3: ****IMm3: ****IMm3:
****IMm3: ****IMm3: ****IMm3: ****IMm3: ****IMm3: ****IMm3: ****IMm3: ****IMm3:
****IMm3: ****IMm3: ****IMm3: ****IMm3: ****IMm3: ****IMm3: ****IMm3: ****IMm3:
****IMm3: ****Aborted
Working:
XXX@willow:~/halt$ /usr/local/gcc-4.8.1/bin/gcc -Wall -O2
-fno-aggressive-loop-optimizations -o halt halt.c
XXX@willow:~/halt$ ./halt
IMm3:
****************************************************************************************************Aborted
Broken:
XXX@willow:~/halt$ /usr/local/gcc-4.8.1/bin/gcc -Wall -O2 -fno-strict-overflow
-o halt halt.c
XXX@willow:~/halt$ ./halt
IMm3: ****
IMm2: ***
IMm1:
*********************************************************************************************Aborted
Broken:
XXX@willow:~/halt$ /usr/local/gcc-4.8.1/bin/gcc -Wall -O2
-fno-aggressive-loop-optimizations -fno-strict-overflow -o halt halt.c
XXX@willow:~/halt$ ./halt
IMm3: ****
IMm2: ***
IMm1:
*********************************************************************************************Aborted
Working:
XXX@willow:~/halt$ /usr/local/gcc-4.8.1/bin/gcc -Wall -O2 -fno-strict-overflow
-fno-tree-vrp -o halt halt.c
XXX@willow:~/halt$ ./halt
IMm3: ****
IMm2: ***
IMm1: **
IM: *
Working:
XXX@willow:~/halt$ /usr/local/gcc-4.8.1/bin/gcc -Wall -O2 -fno-strict-overflow
-fwrapv -o halt halt.c
XXX@willow:~/halt$ ./halt
IMm3: ****
IMm2: ***
IMm1: **
IM: *
XXX@willow:~/halt$ /usr/local/gcc-4.8.1/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/usr/local/gcc-4.8.1/bin/gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc-4.8.1/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.8.1/configure --prefix=/usr/local/gcc-4.8.1
Thread model: posix
gcc version 4.8.1 (GCC)