[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

fixed or forbidden register bug (and test case)



>Submitter-Id:	net
>Originator:	Paolo Molaro
>Organization:	Ximian
>Confidential:	no
>Synopsis:	fixed or forbidden register bug (and test case)
>Severity:	serious
>Priority:	medium
>Category:	other
>Class:		rejects-legal
>Release:	3.1.1 20020703 (Debian prerelease) (Debian testing/unstable)
>Environment:
System: Linux luna 2.4.19-pre5 #1 Tue Apr 2 11:33:31 CEST 2002 i686 unknown unknown GNU/Linux
Architecture: i686

host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: /mnt/data/gcc-3.1/gcc-3.1-3.1.1ds2/src/configure -v --enable-languages=c,c++,java,f77,proto,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/g++-v3-3.1 --enable-shared --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --enable-clocale=gnu --enable-__cxa_atexit --enable-threads=posix --enable-java-gc=boehm --enable-objc-gc i386-linux

The same happens also with gcc 2.7.2 and gcc 2.95.4:
gcc -v
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs
gcc version 2.95.4 20011002 (Debian prerelease)
gcc272 -v
Reading specs from /usr/lib/gcc-lib/i386-linux/2.7.2.3/specs
gcc version 2.7.2.3

>Description:

As part of the mono project we build a library that
needs to detect the x86 processor features. The provided function
is compiled correctly when building a static library, but the compilation 
fails when building a shared library.
Until the bug is fixed it would be nce to know if there is a different
workaround. Thanks.

>How-To-Repeat:
Save the following code to a file name cp.c and compile enabling PIC:

static int 
cpuid (int id, int* p_eax, int* p_ebx, int* p_ecx, int* p_edx)
{
	__asm__ __volatile__ ("cpuid"
		: "=a" (*p_eax), "=b" (*p_ebx), "=c" (*p_ecx), "=d" (*p_edx)
		: "a" (id));
	return 1;
}

and compile it with:

gcc272 -c -fPIC cp.c
error:
cp.c: In function `cpuid':
cp.c:9: fixed or forbidden register was spilled.
This may be due to a compiler bug or to impossible asm
statements or clauses.

gcc-3.1 -c -fPIC cp.c
error:
cp.c: In function `cpuid':
cp.c:5: can't find a register in class `BREG' while reloading `asm'

gcc-2.95 -c -fPIC cp.c
error:
cp.c: In function `cpuid':
cp.c:7: Invalid `asm' statement:
cp.c:7: fixed or forbidden register 3 (bx) was spilled for class BREG.

>Fix:

Compile without -fPIC and it builds fine. I tryed compiling with different
-O options to no avail.


-- 
To UNSUBSCRIBE, email to debian-gcc-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: