Bug 9074

Summary: [alpha-linux] gcc fails to compile kernel on wildfire
Product: gcc Reporter: 172090
Component: targetAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED INVALID    
Severity: normal CC: falk.hueffner, gcc-bugs
Priority: P3 Keywords: ice-on-valid-code
Version: 3.2.2   
Target Milestone: ---   
Host: Target: alpha-linux
Build: Known to work:
Known to fail: Last reconfirmed: 2004-08-19 05:33:30
Attachments: bug-172090.i.gz

Description 172090 2002-12-27 15:56:01 UTC
[ Reported to the Debian BTS as report #172090.
  Please CC 172090@bugs.debian.org on replies.
  Log of report can be found at http://bugs.debian.org/172090 ]
	

Compiling the kernel for the Wildfire fails with:

herbert@cardolan:/mnt/home/herbert/src/debian/work/kernel/build/2.4/kernel-image-alpha-2.4/build-wildfire/drivers/char$ /usr/lib/gcc-lib/alpha-linux/3.2.2/cc1 -lang-c -nostdinc -v -I/mnt/big/herbert/build/kernel/2.4/kernel-image-alpha-2.4/build-wildfire/include -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=0 -D__GXX_ABI_VERSION=102 -D__gnu_linux__ -Dlinux -Dunix -D_LONGLONG -D__alpha__ -D__ELF__ -D__gnu_linux__ -D__linux__ -D__unix__ -D_LONGLONG -D__alpha__ -D__ELF__ -D__linux -D__unix -Asystem=linux -D__OPTIMIZE__ -D__STDC_HOSTED__=1 -D__LANGUAGE_C__ -D__LANGUAGE_C -DLANGUAGE_C -Acpu=alpha -Amachine=alpha -D__alpha -D__alpha__ -D__alpha_ev6__ -Acpu=ev6 -D__alpha_bwx__ -Acpu=bwx -D__alpha_max__ -Acpu=max -D__alpha_fix__ -Acpu=fix -D__alpha_cix__ -Acpu=cix -D__KERNEL__ -DMODULE -DMODVERSIONS -DKBUILD_BASENAME=istallion -include /mnt/big/herbert/build/kernel/2.4/kernel-image-alpha-2.4/build-wildfire/include/linux/modversions.h -iwithprefix include istallion.c -quiet -d!
umpbase istallion.c -mno-fp-regs -mcpu=ev67 -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -version -fno-strict-aliasing -fno-common -fomit-frame-pointer -ffixed-8
GNU CPP version 3.2.2 20021202 (Debian prerelease) (cpplib) (Alpha GNU/Linux for ELF)
GNU C version 3.2.2 20021202 (Debian prerelease) (alpha-linux)
        compiled by GNU C version 3.2.2 20021202 (Debian prerelease).
#include "..." search starts here:
#include <...> search starts here:
 /mnt/big/herbert/build/kernel/2.4/kernel-image-alpha-2.4/build-wildfire/include
 /usr/lib/gcc-lib/alpha-linux/3.2.2/include
End of search list.
istallion.c: In function `stli_allocbrd':
istallion.c:4738: warning: int format, different type arg (arg 2)
istallion.c: In function `stli_memread':
istallion.c:4895: unable to find a register to spill in class `R27_REG'
istallion.c:4895: this is the insn:
(insn 191 423 192 (parallel[
            (set (reg:DI 2 $2 [123])
                (umod:DI (reg:DI 24 $24 [122])
                    (reg:DI 25 $25 [117])))
            (clobber (reg:DI 23 $23))
            (clobber (reg:DI 28 $28))
        ] ) 37 {*divmoddi_internal_er} (insn_list 189 (insn_list 184 (insn_list:REG_DEP_ANTI 180 (nil))))
    (expr_list:REG_DEAD (reg:DI 24 $24 [122])
        (expr_list:REG_UNUSED (reg:DI 23 $23)
            (expr_list:REG_UNUSED (reg:DI 28 $28)
                (nil)))))
istallion.c:4895: confused by earlier errors, bailing out

The compile works if the kernel is configured as generic as opposed to Wildfire.

[attaching the preprocessed source in a followup mail]

Release:
3.2.2 CVS 021212 (Debian) (Debian unstable)

Environment:
System: Debian GNU/Linux (unstable)
Architecture: alpha
host: alpha-linux
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,pascal,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-java-gc=boehm --enable-objc-gc alpha-linux
Thread model: posix
gcc version 3.2.2 20021212 (Debian prerelease)
Comment 1 falk.hueffner 2003-02-10 02:54:47 UTC
From: Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
To: gcc-gnats@gcc.gnu.org, 172090@bugs.debian.org, gcc-bugs@gcc.gnu.org, herbert@gondor.apana.org.au
Cc:  
Subject: Re: target/9074: [alpha-linux] gcc fails to compile kernel on wildfire
Date: 10 Feb 2003 02:54:47 +0100

 Hi,
 
 not quite sure what's going on, but the problem is still there in gcc
 version 3.4 20030203. Here's a smaller testcase:
 
 extern inline void copy_tofrom_user(long len)
 {
     register long pv asm("$27") = 0;
     register long cu_from asm("$7") = 0;
     asm volatile ("" : "=r"(len), "=r"(cu_from), "=r"(pv)
 		     : "0"(len), "1"(cu_from), "2"(pv));
 }
 
 static void stli_memread(int *brdp) {    
     copy_tofrom_user(1 % *brdp);
 }
 
 Looks like some conflict between the divmod pattern and the $27 asm.
 
 -- 
 	Falk
Comment 2 Andrew Pinski 2003-05-25 23:39:24 UTC
See Falk's comment.
Comment 3 Andrew Pinski 2004-01-02 06:34:04 UTC
You have to remove the static or add -fno-unit-at-a-time to the command line.
Comment 4 Richard Henderson 2004-08-26 04:36:57 UTC
Yes.  It's unfortunate, but hard-coded register numbers get that way.

The correct way to fix this is to use the new "c" register constraint
and to not use $27 as an explicit asm register.  I've had to make similar
changes to glibc.

I'll take care of getting this change pushed into the kernel.