This is the mail archive of the
mailing list for the binutils project.
Re: [TI C6x] BUG: Incorrect assembly generated
- From: Timon ter Braak <timon at terbraak dot org>
- To: binutils at sourceware dot org
- Date: Tue, 12 Mar 2013 12:06:07 +0100
- Subject: Re: [TI C6x] BUG: Incorrect assembly generated
- References: <513F0A76.firstname.lastname@example.org>
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;
Hopefully this can be fixed.