[TI C6x] BUG: Incorrect assembly generated
Timon ter Braak
Tue Mar 12 11:06:00 GMT 2013
A small addition:
I found that compiling with -O0 does work fine. Even -O1 gives the
reported issue. As this is an optimization-related issue, should it be
directed to GCC?
On 03/12/2013 11:59 AM, Timon ter Braak wrote:
> I have a piece of code that results in invalid assembly. This is just an
> example, as I suspect a general issue with the assembler, due to the
> SIGBUS and SIGILL signals I receive in a larger codebase.
> I use binutils 2.23.1 and gcc 4.7.2. The function that serves as an
> example is the gcc-builtin __sync_bool_compare_and_swap. When I put a
> printf statement in front of it, different assembly is generated which
> works correctly. The second (normal) part of the code results in
> assembly where a specific register (b2) is being reused, although it is
> already overwritten by the result of a comparison. This results in an
> infinite loop, as __sync_bool_compare_and_swap always returns a value
> indicating that the swap failed.
> In the incorrect assembly, at address 0xed0, register b2 is reused,
> showing a behavior like 'return (*val == (*val == current));'.
> I am not sure whether this issue should be directed to binutils or gcc;
> please advice.
> Hopefully this can be fixed.
More information about the Binutils