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

Bug#561249: Spurious warning with -Wconversion (uint16_t/htons) in -O2 mode



Package: g++-4.4
Version: 4.4.2-5
Severity: normal


The bug may be rather in libc6-dev, which defines:
htons to __bswap16 if optimize && little endian,
and __bswap16 in bits/byteswap.h
# define __bswap_16(x) \
     (__extension__                                                           \
      ({ register unsigned short int __v, __x = (x);                          \
         if (__builtin_constant_p (__x))                                      \
           __v = __bswap_constant_16 (__x);                                   \
         else                                                                 \
           __asm__ ("rorw $8, %w0"                                            \
                    : "=r" (__v)                                              \
                    : "0" (__x)                                               \
                    : "cc");                                                  \
         __v; }))
I'm not expert enough with gcc inline assembly to guess what the exact
problem is, but it is definitely in this macro or the way gcc handles it,
but since gcc <= 4.2 noes not show any warning in optimize it, I'd rather
think it is a gcc (4.3 & 4.4) regression

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.31-1-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages g++-4.4 depends on:
ii  gcc-4.4                   4.4.2-5        The GNU C compiler
ii  gcc-4.4-base              4.4.2-5        The GNU Compiler Collection (base 
ii  libc6                     2.10.2-2       GNU C Library: Shared libraries
ii  libgmp3c2                 2:4.3.1+dfsg-3 Multiprecision arithmetic library
ii  libmpfr1ldbl              2.4.2-3        multiple precision floating-point 
ii  libstdc++6-4.4-dev        4.4.2-5        The GNU Standard C++ Library v3 (d

g++-4.4 recommends no packages.

Versions of packages g++-4.4 suggests:
pn  g++-4.4-multilib              <none>     (no description available)
pn  gcc-4.4-doc                   <none>     (no description available)
pn  libstdc++6-4.4-dbg            <none>     (no description available)

-- no debconf information



Reply to: