This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug regression/28170] New: Wrong result after swap byte in one word when compiled in 64-bit mode
- From: "bergner at vnet dot ibm dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Jun 2006 18:41:28 -0000
- Subject: [Bug regression/28170] New: Wrong result after swap byte in one word when compiled in 64-bit mode
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
A simple byte swap routine gets the wrong result when compiled with -m64 and
either -O1, -O2, -O3 or -Os.
bergner@vervain:~> /opt/biarch/gcc41-base/bin/gcc -O1 -m64 badswap.c
bergner@vervain:~> ./a.out
Before: 0x11 0x22 0x33 0x44 0x55 0x66 0x77 0x88
Result: 0x88 0x77 0x66 0x55 0x44 0x77 0x22 0x11
Expected: 0x88 0x77 0x66 0x55 0x44 0x33 0x22 0x11
Notice the third to last byte in "Result" is 0x77 when it should be 0x33. This
works with -O0 and with gcc 3.4 or earlier versions.
--
Summary: Wrong result after swap byte in one word when compiled
in 64-bit mode
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: regression
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bergner at vnet dot ibm dot com
GCC build triplet: powerpc64-linux
GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28170