[Bug c/48090] New: gcc 4.5.2 miscompilation when building on arm
arnaud.patard@rtp-net.org
gcc-bugzilla@gcc.gnu.org
Sat Mar 12 09:01:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48090
Summary: gcc 4.5.2 miscompilation when building on arm
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: arnaud.patard@rtp-net.org
With gcc-4.5.2, even with gcc-4.5-20110310, the following line of code gets
miscompiled (See attachment) :
size -= nblk * 512;
size and nblk are 64 bits.
gcc tries to compute -nblk. nblk is stored in r0,r1. gcc produces the following
asm code :
rsbs r1, r0, #0
rsc r2, r1, #0
So r1 gets corrupted by the rsbs insn, thus getting wrong value in r2.
I'm building the asm code with :
gcc -O2 -march=armv5t list2.i -o - -S
When I use :
gcc -O2 -fno-cse-follow-jumps -march=armv5t list2.i -o - -S
I get :
rsbs r0, r0, #0
rsc r1, r1, #0
which is fine.
More information about the Gcc-bugs
mailing list