summary refs log tree commit diff
path: root/nptl/tst-initializers1-c89.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-09-05 15:14:09 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-09-05 15:14:09 +0000
commit99d6791899c43eb31b4d1896134501d814da7741 (patch)
treeecc50e46abf386187fc9a5fbc2bad6faf296a68d /nptl/tst-initializers1-c89.c
parent3f802aeb3403a558426b50d42a50c6bfcc6cc425 (diff)
downloadglibc-99d6791899c43eb31b4d1896134501d814da7741.tar.gz
glibc-99d6791899c43eb31b4d1896134501d814da7741.tar.xz
glibc-99d6791899c43eb31b4d1896134501d814da7741.zip
Fix pcprofiledump cross-endian condition (bug 22086).
debug/pcprofiledump.c contains code that tries to handle other-endian
data.  This uses a condition "(word & 0xfffffff0) == bswap_32
(0xdeb00000)".  This condition is always false (the LHS always has the
low four bits zero, the RHS doesn't); a correct comparison would use
0x0fffffff.  This results in -Werror=tautological-compare build
failures with the tile version of bits/byteswap.h and mainline GCC.

https://sourceware.org/ml/libc-testresults/2017-q3/msg00400.html

pcprofiledump.c: In function 'main':
pcprofiledump.c:118:39: error: bitwise comparison always evaluates to false
[-Werror=tautological-compare]
   int must_swap = (word & 0xfffffff0) == bswap_32 (0xdeb00000);
                                       ^~

This patch fixes the condition.  Tested for x86_64, and with
build-many-glibcs.py that it fixes the build for tilegx-linux-gnu.
(Note that I have not tested the actual pcprofiledump functionality,
native or cross endian, which lacks any testsuite coverage.)

	[BZ #22086]
	* debug/pcprofiledump.c (main): Use byte-swapped mask when
	comparing word with byte-swapped constant.
Diffstat (limited to 'nptl/tst-initializers1-c89.c')
0 files changed, 0 insertions, 0 deletions