Created attachment 24067 [details] Output of "ajo-gcc -v -w -O -ftree-fre -c test105974-reduced.c" This reproduces for me with svn revision 172796 (2011-04-20), but it doesn't reproduce with gcc-4.4. I'm on Ubuntu 10.10, x86-64. Attached "gcc-v.txt". cat >test105974.c <<EOF extern volatile int g_4[1][4]; extern int g_7; void modify(int *); void func_2() { int l_46 = 4; if (g_7) { modify(&l_46); } else { int i; for (i = 0; i != 5; i += 1) { volatile int *vp = &g_4[0][l_46]; *vp = 0; } } } EOF gcc -w -O -c test105974.c [hangs] gcc -w -O -fno-tree-fre -c test105974.c [passes] This test case is reduced from the output of Csmith (http://embed.cs.utah.edu/csmith/), using the following command line: csmith --bitfields --packed-struct -s 105974 >test105974.c gcc -w -I../csmith-2.0.0/runtime -O -c test105974.c As I said, it reproduces for me only with a home-built bleeding-edge GCC, and I'm still pretty unfamiliar with the GCC build process, so don't bite too hard if this turns out to be user error on my end. ;)
Here's another test case with exactly the same symptom. Again, it works with gcc-4.4 but fails with my bleeding-edge gcc. The braces around the inner loop are significant. Notice that the offending assignment to "gp" is actually dead code. cat >test106865.c <<EOF extern volatile int g_89[5][9]; extern int g, *gp; void func_64() { int i; for (i = 0; i < 1; ) { for (g = 0; g < 1; ) { return; } gp = &g_89[g][0]; } } EOF gcc -w -O1 -c test106865.c [hangs] gcc -w -O1 -fno-tree-pre -c test106865.c [passes]
Mine. Indeed looks like 48694 - thanks for the small testcases.
Dup. *** This bug has been marked as a duplicate of bug 48694 ***