From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4862 invoked by alias); 25 Feb 2013 13:15:05 -0000 Received: (qmail 4666 invoked by uid 48); 25 Feb 2013 13:14:47 -0000 From: "gnugcc at emblocks dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/56441] [ARM Thumb] generated asm code produces "branch out of range" error in gas with -O1 -mcpu=cortex-m3 Date: Mon, 25 Feb 2013 13:15:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gnugcc at emblocks dot org X-Bugzilla-Status: WAITING X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2013-02/txt/msg02366.txt.bz2 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