I don't believe the program below should crash when run. Valgrind says the store at line 20 is at fault, which is strange since it looks like the "if" branch should execute twice and the "else" branch 0 times.
reg...@john-home:~$ current-gcc -O small.c -o small reg...@john-home:~$ ./small Segmentation fault reg...@john-home:~$ cat small.c #include <stdio.h> int g_6[1][2] = {{1,1}}; int g_34 = 0; int *const g_82 = &g_6[0][1]; int *g_85[2][1] = {{&g_34}, {&g_34}}; void func_4 (void) { int i; for (i = 0; i <= 1; i++) { if (g_6[0][1]) { *g_82 = 1; } else { int **l_109 = &g_85[1][0]; if (&g_82 != l_109) { } else { *l_109 = &g_6[0][1]; } *g_82 = 1; } } } int main (void) { func_4(); return 0; } reg...@john-home:~$ current-gcc -v Using built-in specs. COLLECT_GCC=current-gcc COLLECT_LTO_WRAPPER=/home/regehr/z/compiler-install/gcc-r157783-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-r157783-install --program-prefix=r157783- --enable-languages=c,c++ Thread model: posix gcc version 4.5.0 20100328 (experimental) (GCC) -- Summary: possible wrong code bug Product: gcc Version: unknown 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=43560