Re: this looks like a bug - arm target

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Eric de Jong" <list_ericdejong_10@xxxxxxx> 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


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux