From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10329 invoked by alias); 26 Feb 2013 09:06:13 -0000 Received: (qmail 10167 invoked by uid 48); 26 Feb 2013 09:05:38 -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: Tue, 26 Feb 2013 09:06: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/msg02442.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56441 --- Comment #7 from gnugcc at emblocks dot org 2013-02-26 09:05:36 UTC --- 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.