This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/33674] New: Nonexistent i386 register name `%SIL' used
- From: "richardpku at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Oct 2007 07:06:39 -0000
- Subject: [Bug c/33674] New: Nonexistent i386 register name `%SIL' used
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
GCC tries to use a register `%SIL' in my test on an i386 machine. However, the
lowest 8 bits of ESI can be directly accessed only in x86-64, but not i386. I
also observe in other tests the use of another two bad register names `%DIL'
and `%BPL'.
The following code can reproduce the bug:
static inline char contain (const char *ptr, int len, char c)
{
char r;
int od,oc;
asm volatile (
"cld\n\t"
"repnz scasb\n\t"
"sete %0"
:"=r"(r),"=D"(od),"=c"(oc)
:"c"(len),"a"(c),"D"(ptr)
);
return r;
}
__attribute__((regparm(3)))
int test(int a, int b, int c, int d, const char *buf, int len, int ch)
{
d += a * b;
if (contain (buf, len, ch))
a++;
return a+b+c+d;
}
The command line and the error message:
$ gcc -save-temps -O1 -c test.c -Wall -Wextra
test.s: Assembler messages:
test.s:21: Error: bad register name `%sil'
I checked the assembly output and found that GCC had allocated `%SIL' for `r'
in function `contain'.
The following is my GCC version info:
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2
--enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr
--enable-targets=all --enable-checking=release --build=i486-linux-gnu
--host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.2.1 (Debian 4.2.1-6)
--
Summary: Nonexistent i386 register name `%SIL' used
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: richardpku at gmail dot com
GCC build triplet: i486-linux-gnu
GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33674