This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/48090] New: gcc 4.5.2 miscompilation when building on arm
- From: "arnaud dot patard at rtp-net dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 12 Mar 2011 09:01:39 +0000
- Subject: [Bug c/48090] New: gcc 4.5.2 miscompilation when building on arm
- Auto-submitted: auto-generated
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.