http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53160
Bug #: 53160 Summary: likely wrong code bug Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: reg...@cs.utah.edu CC: cheny...@cs.utah.edu regehr@regehr-System-Product-Name:~$ current-gcc -O1 small.c ; ./a.out 0 regehr@regehr-System-Product-Name:~$ current-gcc -O2 small.c ; ./a.out 1466236928 regehr@regehr-System-Product-Name:~$ cat small.c int printf (const char *, ...); int a, c = 1, d, e, g; volatile int b; volatile char f; long h; short i; void fn1 (p1) { e = 0; for (; e; ++e) ; } int main () { fn1 (g && b); d = 0; for (; d >= 0; d--) { short j = f; int k = 0; i = j ? j : j << k; } h = c == 0 ? 0 : i; a = h; printf ("%d\n", a); return 0; } regehr@regehr-System-Product-Name:~$ current-gcc -v Using built-in specs. COLLECT_GCC=current-gcc COLLECT_LTO_WRAPPER=/home/regehr/z/compiler-install/gcc-r186920-install/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../configure --with-libelf=/usr/local --enable-lto --prefix=/home/regehr/z/compiler-install/gcc-r186920-install --program-prefix=r186920- --enable-languages=c,c++ Thread model: posix gcc version 4.8.0 20120427 (experimental) (GCC)