Bug#181910: libc6: Incorrect fall-back case in byteswap.h for i386
On Saturday 22 February 2003 03:05, GOTO Masanori wrote:
> At Fri, 21 Feb 2003 17:21:50 +0100,
>
> Allan Sandfeld Jensen wrote:
> > 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
>
> This bug will be fixed after updating the current cvs or
> the transition to the next glibc version (2.3.2).
>
Sorry there was a bug in my patch. Ofcourse I mean "__bswap_constant_16" and
-32 and not "contant" ;)
`Allan
Reply to: