[Bug target/56441] [ARM Thumb] generated asm code produces "branch out of range" error in gas with -O1 -mcpu=cortex-m3
rearnsha at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Feb 26 17:03:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56441
--- Comment #9 from Richard Earnshaw <rearnsha at gcc dot gnu.org> 2013-02-26 17:03:10 UTC ---
(In reply to comment #7)
> I was looking completely wrong, the arm_addsi3 is acting wrong.
>
> The "add%?\\t%0, %1, %2" for "=l,%0,Py" is set at a length of 2.
> (first entry in the list)
>
> However the "ADD r6,r6, #65" is a thumb2 instruction which is 4 bytes and not
> 2.
>
> An "ADDS r6,r6,#65" will go right because this is a thumb instruction of 2
> bytes.
>
> Same for the first "SUB" in the same list.
>
> So I end up with a miscalculation of 2bytes.
>
> Perhaps it's better to make it conservative and always use length of 4.
>
>
> I guess that this isn't the right way but I have put un-predicables in front of
> the predicable counter parts with the right length of 4.
This doesn't make sense. arm_addsi3 in my copy of the sources doesn't use the
Py constraint.
Exactly what version of GCC are you using?
More information about the Gcc-bugs
mailing list