[PATCH] i386: Fix GCC running out of registers for bits/string.h
Denis Vlasenko
vda@ilport.com.ua
Thu Jun 9 13:44:00 GMT 2005
On Wednesday 08 June 2005 21:12, Maciej W. Rozycki wrote:
> Hello,
>
> When building for the i386 as follows:
>
> $ ../configure --prefix=/usr --enable-add-ons --enable-omitfp --build=i386-linux
> $ make
>
> using GCC 4.0.0 I have got the following error:
>
> dcigettext.c: In function '_nl_find_msg':
> ../sysdeps/i386/bits/string.h:655: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
Cannot reproduce it here in a isolated testcase.
This one compiles with gcc 4.0.0 just fine:
t.c
===
#define NL "\n"
__const char *
strcspn (__const char *__s, __const char *__reject)
{
unsigned long int __eax, __ebx, __ecx, __edi;
char *__esi;
__asm__ __volatile__(NL
" cld" NL
" movl %5,%%edi" NL
" repne; scasb" NL
" notl %%ecx" NL
" leal -1(%%ecx),%%ebx" NL
"1:" NL
" lodsb" NL
" testb %%al,%%al" NL
" je 2f" NL
" movl %5,%%edi" NL
" movl %%ebx,%%ecx" NL
" repne; scasb" NL
" jne 1b" NL
"2:" NL
: "=&S" (__esi), "=&a" (__eax), "=&b" (__ebx), "=&c" (__ecx), "=&D" (__edi)
: "d" (__reject), "0" (__s), "1" (0), "2" (0xffffffff),
"m" ( *(struct { char __x[0xfffffff]; } *)__s)
: "cc");
return (__esi - 1) - __s;
}
# gcc -O2 -fomit-frame-pointer -S t.c
strcspn:
pushl %ebp
pushl %edi
pushl %esi
pushl %ebx
pushl %ecx
movl 24(%esp), %ebp
movl 28(%esp), %edx
xorl %ecx, %ecx
movl $-1, %ebx
movl %ebp, %esi
movl %ecx, %eax
#APP
cld
movl %edx,%edi
repne; scasb
notl %ecx
leal -1(%ecx),%ebx
1:
lodsb
testb %al,%al
je 2f
movl %edx,%edi
movl %ebx,%ecx
repne; scasb
jne 1b
2:
#NO_APP
movl %esi, %edx
subl %ebp, %edx
leal -1(%edx), %eax
popl %edx
popl %ebx
popl %esi
popl %edi
popl %ebp
ret
--
vda
More information about the Libc-alpha
mailing list