From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31161 invoked by alias); 6 Nov 2012 15:41:02 -0000 Received: (qmail 31109 invoked by uid 48); 6 Nov 2012 15:40:44 -0000 From: "amylaar at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/55195] [4.8 Regression] shorten_branches generates incorrect forward branch distances Date: Tue, 06 Nov 2012 15:41:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: amylaar at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: 2012-11/txt/msg00493.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55195 --- Comment #11 from Jorn Wolfgang Rennecke 2012-11-06 15:40:43 UTC --- (In reply to comment #10) > The insn is actually a millicode call (branch) which needs to be able > to reach stub table. Different variants are generated depending on > pc. I modified the opaque clause a bit as I decided I didn't want to it > to depend on operand 0. Don't see how a negative length can arise. I was actually astonished that these patterns work at all to some extent; the way I recalled it, you have to test for every possible value of your c-function in a cond clause, and then provide that value as a constant, for the length calculation to work. I see now that you get INT_MAX substituted as the maximum length if the value is unknown. If you add anything to that, the value becomes negative. I suppose your only get-out-of-jail card with the current interface, if you can't/won't provide a full cond with constant values, is to let ADJUST_INSN_LENGTH obliterate the MAX_INT, and replace it with something sensible.