[Bug tree-optimization/56097] New: Segmentation fault with -01 -ftree-vrp -ftree-loop-distribute-patterns -funswitch-loops

stijnv at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Jan 24 13:27:00 GMT 2013


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

             Bug #: 56097
           Summary: Segmentation fault with -01 -ftree-vrp
                    -ftree-loop-distribute-patterns -funswitch-loops
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: stijnv@gmail.com


Possible duplicate of bug 55964. The following test case fails with -01
-ftree-vrp -ftree-loop-distribute-patterns -funswitch-loops. The same test case
worked fine with gcc 4.5:

$ cat test3.c
struct test_struct {
  int a, b[10], c[10], d[10];
};

extern struct test_struct* new_struct;

void testfunc(struct test_struct* old_struct) {
  int i;
  for (i = 0; i < 10; ++i) {
    new_struct->b[i] = old_struct ? old_struct->b[i] : -1;
    new_struct->c[i] = old_struct ? old_struct->c[i] : 0;
    new_struct->d[i] = old_struct ? old_struct->d[i] : 0;
  }
  /* commenting out the following line eliminates the crash */
  if (old_struct) old_struct->a++;
}

$ gcc -c -O1 -ftree-vrp -ftree-loop-distribution -funswitch-loops -o test3.o
test3.c
test3.c: In function ‘testfunc’:
test3.c:7:6: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.

$ gcc -v
gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1)



More information about the Gcc-bugs mailing list