This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: this looks like a bug - arm target
- From: Falk Hueffner <falk dot hueffner at student dot uni-tuebingen dot de>
- To: "Eric de Jong" <list_ericdejong_10 at gmx dot net>
- Cc: <gcc-help at gcc dot gnu dot org>
- Date: 09 Oct 2003 14:26:04 +0200
- Subject: Re: this looks like a bug - arm target
- References: <000901c38e3c$d6ec05c0$e33922c7@ericnt>
"Eric de Jong" <list_ericdejong_10@gmx.net> writes:
> I stumbled across a code generation problem. I am still using gcc
> 3.3.0, so maybe this is an old bug. Anyone care to verify this?
>
> The problem is in the line "strgtb r2, [r0, #2]":
>
> cmp r3, #7
> strgtb r2, [r0, #2]
> ble .L9
>
> In the loop "for (r3=0; r3<8; r3++)" I expected "[r0,#2] = r2, but
> the condition 'gt' in 'strgtb' only stores the result when r3 >
> 7. It should be <=7. (Thus strleb r2,[r0.#2] I think)
Since the stores are dead, gcc is free to omit them if it likes to.
You need to mark the object volatile, in which case gcc 3.3.2 emits:
.L9:
mov ip, r1, asl r2
add r2, r2, #1
cmp r2, #7
strb ip, [r0, #2]
ble .L9
Admittedly, the code emitted for the non-volatile version is weird,
and there may be an actual bug lurking there.
--
Falk