http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48921

           Summary: Value numbering takes infinite time on nested infinite
                    loop
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: arthur.j.odw...@gmail.com


Created attachment 24203
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24203
Output of "ajo-gcc -O1 -c test993353039.c -v"

This reproduces for me with svn revision 172950 (2011-04-25), but not with 4.4
or 4.5.  I'm on Ubuntu 10.10, x86-64.

cat >test993353039.c <<EOF
extern int g_38, g_70;
extern int * volatile g_65[4][1];

void func_110() {
  for (g_70 = 0; g_70 < 2; ++g_70)
    while (1)
      g_38 = (g_65[g_70] != 0);
}
EOF
gcc -O1 -c test993353039.c

[hangs looping in tree-ssa-sccvn.c:run_scc_vn, i.e., value numbering.]

I wonder if this is related to bug 48732. They seem to be in different
components, but both bugs do involve simple nested loops where the compile time
ends up proportional to the run time --- except that in this case both times
are infinite!

Also notice that the expression (g_65[g_70] != 0) will be constant-folded to
"1", but if you use the literal "1" instead, the bug goes away.

Reply via email to