This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/56441] [ARM Thumb] generated asm code produces "branch out of range" error in gas with -O1 -mcpu=cortex-m3
- From: "gnugcc at emblocks dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 25 Feb 2013 13:14:46 +0000
- Subject: [Bug target/56441] [ARM Thumb] generated asm code produces "branch out of range" error in gas with -O1 -mcpu=cortex-m3
- Auto-submitted: auto-generated
- References: <bug-56441-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56441
--- Comment #5 from gnugcc at emblocks dot org 2013-02-25 13:14:46 UTC ---
Could it be that in the file arm.md concerning the following snippet:
(define_insn "*arm_jump"
[(set (pc)
(label_ref (match_operand 0 "" "")))]
"TARGET_32BIT"
"*
{
if (arm_ccfsm_state == 1 || arm_ccfsm_state == 2)
{
arm_ccfsm_state += 2;
return \"\";
}
return \"b%?\\t%l0\";
}
"
[(set_attr "predicable" "yes")
(set (attr "length")
(if_then_else
(and (match_test "TARGET_THUMB2")
(and (ge (minus (match_dup 0) (pc)) (const_int -2044))
(le (minus (match_dup 0) (pc)) (const_int 2048))))
(const_int 2)
(const_int 4)))]
)
the (match_test "TARGET_THUMB2") must be replaced by
(and (not(match_test "TARGET_THUMB2"))
same for
- "*arm_cond_branch"
- "*arm_cond_branch_reversed"
the assembler always uses b.w even if the branch is only 10 bytes away.
Regards