[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#181910: libc6: Incorrect fall-back case in byteswap.h for i386



Package: libc6
Version: 2.3.1-13
Severity: normal
Tags: upstream patch

In bits/byteswap.h for both __bswap_16 and __bswap_32 there is the following check:
#if defined __GNUC__ && __GNUC__ >= 2

The problem is that in the fall-back #else branch for non-gcc C-compilers it still uses gcc-extensions. The problem does exist also in the official glibc-2.3.1 under the i386-arch, but it is correct in the generic-arch. The attached patch moves the fall-back code from the generic arch to the i386 arch.

--- byteswap.h.old      2003-01-18 15:19:31.000000000 +0100
+++ byteswap.h  2003-02-21 17:20:22.000000000 +0100
@@ -40,11 +40,12 @@
                    : "0" (__x)                                               \
                    : "cc");                                                  \
         __v; }))
-#else
-/* This is better than nothing.  */
-# define __bswap_16(x) \
-     (__extension__                                                          \
-      ({ register unsigned short int __x = (x); __bswap_constant_16 (__x); }))
+#else /* This is better than nothing.  */
+static __inline unsigned short int
+__bswap_16 (unsigned short int __bsx)
+{
+  return __bswap_contant_16(__bsx);
+}
 #endif


@@ -81,9 +82,11 @@
         __v; }))
 # endif
 #else
-# define __bswap_32(x) \
-     (__extension__                                                          \
-      ({ register unsigned int __x = (x); __bswap_constant_32 (__x); }))
+static __inline unsigned int
+__bswap_32 (unsigned int __bsx)
+{
+  return __bswap_contant_32(__bsx);
+}
 #endif



-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux cinex 2.4.19-k7-smp #1 SMP Tue Nov 19 04:02:50 EST 2002 i686
Locale: LANG=en_GB.UTF-8, LC_CTYPE=da_DK

Versions of packages libc6 depends on:
ii  libdb1-compat                 2.1.3-7    The Berkeley database routines [gl

-- no debconf information




Reply to: