This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
glibc 2.3.1: fix for the i386 inline strings code
- From: Denis Zaitsev <zzz at cd-club dot ru>
- To: Ulrich Drepper <drepper at redhat dot com>, Andreas Jaeger <aj at suse dot de>
- Cc: libc-alpha at sources dot redhat dot com, linux-gcc at vger dot kernel dot org
- Date: Mon, 6 Jan 2003 06:30:48 +0500
- Subject: glibc 2.3.1: fix for the i386 inline strings code
Nobody has answered to me for a while, so I'm resending this
politely...
This is a trivial patch for the inlined i386 strings' header. Without
it, say, X11 can't be compiled with -D__USE_STRING_INLINES - a
problems will be caused by XtNewString and X11's own bzero. These
problems are cured by the first and the second chunks of the patch,
correspondingly.
So, please, apply this.
--- sysdeps/i386/i486/bits/string.h.orig Fri Jan 3 12:17:55 2003
+++ sysdeps/i386/i486/bits/string.h Sat Jan 4 06:04:08 2003
@@ -40,10 +40,10 @@
/* The macros are used in some of the optimized implementations below. */
#define __STRING_SMALL_GET16(src, idx) \
- (((src)[idx + 1] << 8) | (src)[idx])
+ ((((char*)(src))[idx + 1] << 8) | ((char*)(src))[idx])
#define __STRING_SMALL_GET32(src, idx) \
- ((((src)[idx + 3] << 8 | (src)[idx + 2]) << 8 \
- | (src)[idx + 1]) << 8 | (src)[idx])
+ (((((char*)(src))[idx + 3] << 8 | ((char*)(src))[idx + 2]) << 8 \
+ | ((char*)(src))[idx + 1]) << 8 | ((char*)(src))[idx])
/* Copy N bytes of SRC to DEST. */
@@ -229,7 +229,7 @@ memcmp (__const void *__s1, __const void
assignments using immediate operands. But this uses to much \
memory (7, instead of 4 bytes). So we force the value in a \
registers. */ \
- if (n == 3 || n >= 5) \
+ if ((n) == 3 || (n) >= 5) \
__asm__ __volatile__ ("" : "=r" (__c) : "0" (__c)); \
\
/* This `switch' statement will be removed at compile-time. */ \