On Wed, Apr 27, 2011 at 9:52 PM, Barry Song 21cnbao@gmail.com wrote:
2011/4/27 Andrew Stubbs andrew.stubbs@linaro.org:
On 27/04/11 10:23, Barry Song wrote:
the target binary got crash while running on armv7 board, not gcc :-)
I suspect I know what the problem is here.
Can you try again with -fno-shrink-wrap, please?
i guess it is related with this bug:
Hi Barry. Thank you for the bug report. I've confirmed this with gcc-linaro-4.5-2011.04-0 on ARM and logged LP: #772085 at: https://bugs.launchpad.net/gcc-linaro/+bug/772085
Please subscribe to the bug if you'd like to be updated with any progress.
As you say, the generated code is incorrect and clobbers r3 before use:
unifi_trace: @ args = 4, pretend = 8, frame = 8 @ frame_needed = 0, uses_anonymous_args = 1 movw r3, #:lower16:.LANCHOR0 movt r3, #:upper16:.LANCHOR0 ldr r3, [r3, #0] cmp r3, r1 bge .L6 bx lr .L6: push {r2, r3}
This only occurs if you add the -fshrink-wrap option. It does not occur at -O1, -O2, or -O3. The fault does not occur in Linaro GCC 4.6, gcc-4.5.2, or gcc-4.6.0. I suggest you update to Linaro GCC 4.5-2011.04 which fixes a number of other shrink wrap bugs and also disables it by default.
I've set it to medium priority as while it is bad-code, the fault only occurs if you add -fshrink-wrap. This fault will be fixed before shrink wrapping is turned back on by default.
This is probably the same fault as LP: #736081 and LP: #771675.
-- Michael