[Bug tree-optimization/55107] New: GCC in an infinite loop at -O2

antoine.balestrat at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Oct 28 14:23:00 GMT 2012


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

             Bug #: 55107
           Summary: GCC in an infinite loop at -O2
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: antoine.balestrat@gmail.com


Hello !
GCC 4.8.0 as of 20121021 and GCC 4.7.2 won't compile the following testcase at
-O2 and higher because they look stuck in an infinite loop.

$ cat infinite.c
#include <stdint.h>

uint16_t a, b;

uint16_t f(void)
{
    int c, **p;
    short d = 2, e = 4;

    for (;; b++)
    {
        int *j, k = 0;

        for (; *j; j++)
        {
            for(; c; c++)
                for(; k < 1; k++)
                {
                    short *f = &d;

                    if(b)
                        return *f;
                }
        }

        if(!c)
            d *= e;

        ((a = d) ? b = 0 : (**p ? : 1) != (d != 1 ? : (a = 0))) != (k ? a : 0)
< (a *= c = k) && (**p = 0);
    }
}

$ ulimite -t 60

$ xgcc -O2 -w infinite.c
cc: internal compiler error: CPU time limit exceeded (program cc1)
linux-vdso.so.1: No such file or directory
0x40b937 execute
    ../../srcdir/gcc/gcc.c:2739
0x40c7be do_spec_1
    ../../srcdir/gcc/gcc.c:4534
0x40f0d5 process_brace_body
    ../../srcdir/gcc/gcc.c:5782
0x40f0d5 handle_braces
    ../../srcdir/gcc/gcc.c:5696
0x40d397 do_spec_1
    ../../srcdir/gcc/gcc.c:5179
0x40f0d5 process_brace_body
    ../../srcdir/gcc/gcc.c:5782
0x40f0d5 handle_braces
    ../../srcdir/gcc/gcc.c:5696
0x40d397 do_spec_1
    ../../srcdir/gcc/gcc.c:5179
0x40cff7 do_spec_1
    ../../srcdir/gcc/gcc.c:5284
0x40f0d5 process_brace_body
    ../../srcdir/gcc/gcc.c:5782
0x40f0d5 handle_braces
    ../../srcdir/gcc/gcc.c:5696
0x40d397 do_spec_1
    ../../srcdir/gcc/gcc.c:5179
0x40f0d5 process_brace_body
    ../../srcdir/gcc/gcc.c:5782
0x40f0d5 handle_braces
    ../../srcdir/gcc/gcc.c:5696
0x40d397 do_spec_1
    ../../srcdir/gcc/gcc.c:5179
0x40f0d5 process_brace_body
    ../../srcdir/gcc/gcc.c:5782
0x40f0d5 handle_braces
    ../../srcdir/gcc/gcc.c:5696
0x40d397 do_spec_1
    ../../srcdir/gcc/gcc.c:5179
0x40f0d5 process_brace_body
    ../../srcdir/gcc/gcc.c:5782
0x40f0d5 handle_braces
    ../../srcdir/gcc/gcc.c:5696
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Note that the stack trace looks the same as in PR55011.



More information about the Gcc-bugs mailing list