This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
glibc 2.3.1: sysdeps/i386/i486/bits/string.h: strspn has a bug
- From: Denis Zaitsev <zzz at cd-club dot ru>
- To: libc-alpha at sources dot redhat dot com
- Date: Sun, 12 Jan 2003 03:20:47 +0500
- Subject: glibc 2.3.1: sysdeps/i386/i486/bits/string.h: strspn has a bug
There is a bug in the inline __strspn_cg implementation: the function
uses (clobbers) eax register, but this fact is not described to the
compiler. The patch below cures the situation. Please, apply it.
--- sysdeps/i386/i486/bits/string.h.orig Sat Jan 4 06:15:38 2003
+++ sysdeps/i386/i486/bits/string.h Wed Jan 8 13:26:16 2003
@@ -1658,7 +1658,7 @@ __strspn_cg (__const char *__s, __const
/* Since we do not know how large the memory we access it, use a really large amount. */
"m" ( *(struct { char __x[0xfffffff]; } *)__s),
"m" ( *(struct { __extension__ char __x[__accept_len]; } *)__accept)
- : "cc");
+ : "cc","eax");
return (__res - 1) - __s;
}
BTW, this bug exists for an ages already, but it had been hiding until
gcc-3 appears (gcc-2.95.x assumes eax to be always clobbered, am I
right?). And thru this gcc-3 era there at least 3 "big and real"
victims suffer from this bug - bind-9.x, postgresql-7.x and inn-2.3.x
(I know these 3, but of course, it must be more). No one of them even
work, would it be compiled with -D__USE_STRING_INLINES.