Bug 23870

Summary: [3.4 regression] loop-unswitching hangs compiler (and whole computer!)
Product: gcc Reporter: Fredrik Hederstierna <fredrik>
Component: rtl-optimizationAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED WONTFIX    
Severity: normal CC: flash, gcc-bugs
Priority: P2 Keywords: compile-time-hog
Version: 3.4.4   
Target Milestone: 3.4.6   
Host: i686-pc-linux-gnu Target: arm-elf
Build: Known to work: 3.3.3
Known to fail: 3.4.5 Last reconfirmed: 2006-01-14 05:44:55

Description Fredrik Hederstierna 2005-09-13 19:54:59 UTC
When I try to compile any of these functions below, GCC 3.4.4 hangs the whole
computer! I was needed to reboot my Feodore Core3 system - severe memory leak?

I'm compiling on a Linux machine running Feodore Core3 kernel 2.6.9.
The compiler is arm-elf-gcc-3.4.4 compiled with binutils-2.16.1, newlib-1.13.0.

I compiled binutils like this:
"../../$BINUTILS_DIR/configure" --target="$TARGET" --prefix="$DEST" --disable-nls
make LDFLAGS=-s all install

I compiled GCC like this:
"../../$GCC_DIR/configure" --enable-languages=c,c++,f77 --target="$TARGET"
--prefix="$DEST" --with-gnu-as --with-gnu-ld --with-newlib --disable-nls
make LDFLAGS=-s all-gcc all-target-libstdc++-v3 install-gcc
install-target-libstdc++-v3

The code that hangs the compiler looks like this:
(Simplified stupid code example just to show the error.)

void hang_compiler1(signed long long x)
{
  while (1) {
    if (x < 0)
      continue;
  }
}

void hang_compiler2(signed long long x)
{
  for (;;) {
    if (x < 0)
      continue;
  }
}

void hang_compiler3(signed long long x)
{
  do {
    if (x < 0)
      continue;
  } while (1);
}
Comment 1 Fredrik Hederstierna 2005-09-13 20:08:36 UTC
This bug only shows when you compile with -O3
Comment 2 Richard Earnshaw 2005-09-14 13:56:50 UTC
Confirmed.  This seems to be a problem with loop unswitching
Comment 3 Richard Earnshaw 2005-10-12 13:42:45 UTC
*** Bug 24322 has been marked as a duplicate of this bug. ***
Comment 4 Gabriel Dos Reis 2006-03-01 04:47:42 UTC
unlikely to be fixed for 3.4.6
Comment 5 Gabriel Dos Reis 2006-03-01 04:47:59 UTC
unlikely to be fixed for 3.4.6
Comment 6 Flash Sheridan 2006-03-01 17:42:27 UTC
Ouch.
PalmSource/Access bug 111534.