Compile the following with -O1 in 4.0 branch.  Don't be in a hurry; I killed it
after 10 minutes, but I'm told it goes for hours.
With -fno-ivopts added it completes almost immediately.  The recursion is
in instantiate_parameters_1 called from simple_iv.

/**********************************************************************/

extern int Loop1Max,Loop2Max;
void bar(int a, int b, int c);
void foo(int parm);

/**********************************************************************/

#define x7(x) x;x;x;x;x;x;x
#define REPL(x) x7(x);x7(x);x7(x);x7(x);x7(x);x7(x)     
        // 6 * 7 = 42 (0.06 seconds compile-time for GCC 3.3, 1 year for GCC 
4.0)
        // Changing REPL from 42 to 21 will reduce GCC 4.0 compile-time to 20 
sec
onds.

/**********************************************************************/
void foo(int parm)
{
        register int x,y;
        register int a,b,c;

        a = b = c = parm;

        for (y=0; y<Loop2Max; ++y)
        {
                for (x=0; x<Loop1Max; ++x)
                {
                        REPL
                        (
                                a = c * a;
                                b = a * b;
                                c = parm - a;
                        );
                }
        }

        bar(a,b,c);

        return;
}

/**********************************************************************/

-- 
           Summary: Pseudo-infinite recursion in ivopts
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dalej at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-apple-darwin8.0.0
  GCC host triplet: powerpc-apple-darwin8.0.0
GCC target triplet: powerpc-apple-darwin8.0.0


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

Reply via email to