Comment 6 for bug 347864

Revision history for this message
Dave Martin (dave-martin-arm) wrote : Re: GCC generates invalid instructions when building for Thumb-2 on armel

It's a GCC bug, so we can disregard binutils (the assembler is correct in rejecting the problem instruction).
It looks like the problem is that GCC is making bad assumptions about operand ranges for some instructions passed to the assembler. Note that the generated instruction would be OK when generating ARM code, but it looks like the Thumb-2 is more restricted with regard to some operand ranges.

We've tried with a new compiler from the CodeSourcery branch (Sourcery G++ Lite 2009q1-123 - Preview, GCC 4.3.3) - this does not hit the bug, but it looks like this could be due to differences in code generation... so this compiler may work just because we are lucky and GCC is not generating the problem instruction when compiling this code.

I do not know the status of any fix relating to this on GCC mainline.

Someone who understands the code generation backend in GCC probably ought to take a look, but I'm not familiar with this myself... It will be hard to find a test case which is reliable across diverse compiler versions, because code generation differences may make the problem appear or disappear.