I believe the result at -O0 is correct. reg...@john-home:~/volatile/bugs/tmp276$ current-gcc -O0 small.c -o small reg...@john-home:~/volatile/bugs/tmp276$ ./small -1 reg...@john-home:~/volatile/bugs/tmp276$ current-gcc -O1 small.c -o small reg...@john-home:~/volatile/bugs/tmp276$ ./small 0 reg...@john-home:~/volatile/bugs/tmp276$ cat small.c int g_21; int g_211; int g_261;
static int i, j, k, l, m; static void func_32 (void) { int * l_359[5][7][1][1][2]; for (i = 0; i < 5; i++) { for (j = 0; j < 7; j++) { for (k = 0; k < 1; k++) { for (l = 0; l < 1; l++) { for (m = 0; m < 2; m++) l_359[i][j][k][l][m] = &g_211; } } } } if (*l_359[0][0][0][0][0]) { lbl_370: g_21 = 1; } for (g_261 = -1; g_261 > -2; g_261--) { if (g_211 + 1) { return; } else { g_21 = 1; goto lbl_370; } } } extern int printf (__const char *__restrict __format, ...); int main(void) { func_32(); printf("%d\n", g_261); return 0; } reg...@john-home:~/volatile/bugs/tmp276$ current-gcc -v Using built-in specs. COLLECT_GCC=current-gcc COLLECT_LTO_WRAPPER=/home/regehr/z/compiler-install/gcc-r157243-install/libexec/gcc/i686-pc-linux-gnu/4.5.0/lto-wrapper Target: i686-pc-linux-gnu Configured with: ../configure --with-libelf=/usr/local --enable-lto --prefix=/home/regehr/z/compiler-install/gcc-r157243-install --program-prefix=r157243- --enable-languages=c,c++ Thread model: posix gcc version 4.5.0 20100305 (experimental) (GCC) -- Summary: possible wrong code bug Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: regehr at cs dot utah dot edu GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43269