This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/18081] New: Infinite memory allocation on -O3


When compiling the following code, cc1
enters an infinite loop allocating memory until
virtual memory is exhausted.

arm-rtems-elf-gcc-3.4.2 -O3 -c -otest.o test.c

The bug disappears when using -O2 or when
using -O3 with -fno-inline-functions or
-fno-gcse
It also disappears by removing lines from the
program.

test.c:

int rd(int *p) {
  if (p<((int*)4)) return 0;
  return *p;
}

void wr(int *p) {
  if (p<((int*)4)) return;
  *p = 0;
}

void test(void *p)
{
  int i;
  int a[2];

  for(i=0;i<2;i++)
  {
    wr(p);
    a[i]=rd(p);
  }
}

-- 
           Summary: Infinite memory allocation on -O3
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: trauscher at loytec dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i386-linux
GCC target triplet: arm-rtems-elf


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]