[Bug rtl-optimization/22528] New: Optimized ARM 'unsigned short's assignments are incorrect for big-endian ARMv3 targets
gcc at embisi dot com
gcc-bugzilla@gcc.gnu.org
Sun Jul 17 18:32:00 GMT 2005
//Reading specs from /usr/local/cross-arm/bin/../lib/gcc-lib/arm-linux/3.3.2/specs
//Configured with:
/home/localgjs/tnbt_cvstrees/software/tools/gcc/../../tools/gcc/configure
--target=arm-linux --disable-shared --disable-threads --with-gnu-as
--with-gnu-ld --enable-multilib --enable-languages=c
--prefix=/usr/local/cross_arm
--with-headers=/home/localgjs/tnbt_cvstrees/software/tools/gcc/../../os/linux/include/
//Thread model: single
//gcc version 3.3.2
// This fails if compiled with... /usr/local/cross-arm/bin/arm-linux-gcc -O1
-mbig-endian -march=armv3 -o test.o -c test.c
// It generates code which sets *us to be 0, not 0x800
// With not big-endian, or without optimization, or with a Thumb-capable arch,
it works
void test(unsigned short *us)
{
*us = (unsigned short)0x800;
return;
}
Output code from above:
Disassembly of section .text:
00000000 <test>:
0: e3a03000 mov r3, #0 ; 0x0
4: e5c03000 strb r3, [r0]
8: e5c03001 strb r3, [r0, #1]
c: e1a0f00e mov pc, lr
If built without -big-endian the output is correct:
Disassembly of section .text:
00000000 <test>:
0: e3a03000 mov r3, #0 ; 0x0
4: e5c03000 strb r3, [r0]
8: e3a03008 mov r3, #8 ; 0x8
c: e5c03001 strb r3, [r0, #1]
10: e1a0f00e mov pc, lr
--
Summary: Optimized ARM 'unsigned short's assignments are
incorrect for big-endian ARMv3 targets
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gcc at embisi dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: arm-linux-gcc?
GCC host triplet: i*86-*-linux
GCC target triplet: arm-linux-elf
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22528
More information about the Gcc-bugs
mailing list