The file fs/ocfs2/dlm/dlmmaster.c from the 2.6.20 kernel triggers an endless
loop in gcc 4.1 built for the hppa64-linux-gnu target.

It occurs at -O2, but not at -O1 or -O0. Also specifying -fno-cse-follow-jumps
workaround the problem.


Thanks to Randolph Chung we have a reduced testcase:

struct bug { int type; };

static void stuck(struct bug *mle, void *res)
{
 if (mle->type == 1) {
  if (res == 0) asm volatile("nop");
 } 
 else if (mle->type == 0) {
  if (res == 0) {
    asm volatile("nop" : : "i" (0)); 
  }
 }
}

void foo(void) { stuck(0, 0); }
void bar(void) { stuck(0, 0); }


And some infos about the compiler used:

Using built-in specs.
Target: hppa64-linux-gnu
Configured with: ../src/configure --enable-languages=c --prefix=/usr
--libexecdir=/usr/lib --disable-shared --disable-nls --disable-threads
--disable-libffi --disable-libgomp --disable-libmudflap --disable-libssp
--with-as=/usr/bin/hppa64-linux-gnu-as --with-ld=/usr/bin/hppa64-linux-gnu-ld
--includedir=/usr/hppa64-linux-gnu/include --host=hppa-linux-gnu
--build=hppa-linux-gnu --target=hppa64-linux-gnu
Thread model: single
gcc version 4.1.3 20070429 (prerelease) (Debian 4.1.2-6)


-- 
           Summary: Endless loop while building a 64-bit 2.6.20 kernel
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: aurelien at aurel32 dot net
 GCC build triplet: hppa1.1-linux-gnu
  GCC host triplet: hppa1.1-linux-gnu
GCC target triplet: hppa64-linux-gnu


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

Reply via email to