This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]