https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118097
--- Comment #22 from David Binderman <dcb314 at hotmail dot com> --- (In reply to Andrew Pinski from comment #21) > Try -fno-ipa-cp As expected, that avoids the problem too: foundBugs $ ../results/bin/gcc -O1 -w bug1071.c && ./a.out 1 > /tmp/0 foundBugs $ ../results/bin/gcc -O2 -w bug1071.c && ./a.out 1 > /tmp/1 foundBugs $ ../results/bin/gcc -O2 -fno-ipa-cp -w bug1071.c && ./a.out 1 > /tmp/2 foundBugs $ ls -l /tmp/? -rw-r--r--. 1 dcb40b dcb40b 18267 Dec 20 09:03 /tmp/0 -rw-r--r--. 1 dcb40b dcb40b 18272 Dec 20 09:03 /tmp/1 -rw-r--r--. 1 dcb40b dcb40b 18267 Dec 20 09:03 /tmp/2 foundBugs $ diff /tmp/0 /tmp/2 foundBugs $ ../results/bin/gcc -O1 -w bug1071B.c && ./a.out 1 > /tmp/0 foundBugs $ ../results/bin/gcc -O2 -w bug1071B.c && ./a.out 1 > /tmp/1 foundBugs $ ../results/bin/gcc -O2 -fno-ipa-cp -w bug1071B.c && ./a.out 1 > /tmp/2 foundBugs $ ls -l /tmp/? -rw-r--r--. 1 dcb40b dcb40b 44153 Dec 20 09:05 /tmp/0 -rw-r--r--. 1 dcb40b dcb40b 44156 Dec 20 09:05 /tmp/1 -rw-r--r--. 1 dcb40b dcb40b 44153 Dec 20 09:05 /tmp/2 foundBugs $ diff /tmp/0 /tmp/2 foundBugs $