__bswap_constant_16 not compiled when -Werror -Wsign-conversion is given (32bit LE ARM)
Edward Jee
edjee@google.com
Mon May 20 23:14:00 GMT 2013
Hi, may I ask a question?
I'm using gcc and glibc on 32bit LE ARM. And I found that the
following code is not compiled, if I give -Werror -Wsign-conversion
arguments to gcc.
#include <stdio.h>
#include <byteswap.h>
int main(int argc, char *argv[]) {
unsigned short int x = 0xbeef;
printf("bswap_16(0x%x)=0x%x\n", x, bswap_16(x));
return 0;
}
I saw compilation error "conversion to 'unsigned int' from 'int' may
change the sign of the result".
It looks like that a similar issue has been solved for x86 by
http://sourceware.org/git/?p=glibc.git;a=commit;h=69da074d7adfab7b57004a0dea9403a928e310a5
.
But the architecture-independent bit/byteswap.h has not been modified
(I'm using that file).
Could someone tell me why this modification is not done for the
architecture-independent bit/byteswap.h ? Am I doing something wrong?
Thanks in advance.
--
Edward Hyun-koo Jee
Software Engineer, Google Inc.
More information about the Libc-help
mailing list