From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26803 invoked by alias); 2 Jan 2006 13:57:14 -0000 Received: (qmail 26789 invoked by uid 48); 2 Jan 2006 13:57:12 -0000 Date: Mon, 02 Jan 2006 13:57:00 -0000 Message-ID: <20060102135712.26788.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/25603] [4.1/4.2 Regression]: Miscompiled FORTRAN program In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jakub at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-01/txt/msg00156.txt.bz2 List-Id: ------- Comment #3 from jakub at gcc dot gnu dot org 2006-01-02 13:57 ------- This seems to be a reload bug, but Alan Modra's patch is correct. In *.lreg we have: (insn 577 78 11 2 (set (reg/f:DI 391) (reg/f:DI 0 ap)) 5 {*movdi_internal} (nil) (nil)) (insn 11 577 14 2 (set (reg/v/f:DI 388 [ nfilt ]) (mem/c/i:DI (post_inc:DI (reg/f:DI 391)) [0 nfilt+0 S8 A64])) 5 {*movdi_internal} (insn_list:REG_DEP_TRUE 577 (nil)) (expr_list:REG_INC (reg/f:DI 391) (expr_list:REG_EQUIV (mem/f/c/i:DI (reg/f:DI 0 ap) [0 nfilt+0 S8 A64]) (nil)))) (insn 14 11 83 2 (set (reg/v/f:DI 389 [ xstart ]) (mem/c/i:DI (reg/f:DI 391) [0 xstart+0 S8 A64])) 5 {*movdi_internal} (insn_list:REG_DEP_TRUE 11 (insn_list:REG_DEP_TRUE 577 (nil))) (expr_list:REG_DEAD (reg/f:DI 391) (expr_list:REG_EQUIV (mem/f/c/i:DI (plus:DI (reg/f:DI 0 ap) (const_int 8 [0x8])) [0 xstart+0 S8 A64]) (nil)))) ap is in this case r12 + 1088, and the difference coming from Alan Modra's patch is that before insn 577 was reloaded to an identical insn (as its INSN_CODE was wrong), while with that fix the insn is kept as is. The only real effect of the reloading resp. not reloading in insn 577 is register choice for reloading of subsequent insn, (insn 11 577 14 2 (set (mem/c/i:DI (plus:DI (reg/f:DI 12 r12) (const_int 1088 [0x440])) [0 nfilt+0 S8 A64]) (mem/c/i:DI (post_inc:DI (reg/f:DI 14 r14 [391])) [0 nfilt+0 S8 A64])) 5 {*movdi_internal} (insn_list:REG_DEP_TRUE 577 (nil)) (expr_list:REG_INC (reg/f:DI 14 r14 [391]) (expr_list:REG_EQUIV (mem/f/c/i:DI (reg/f:DI 0 ap) [0 nfilt+0 S8 A64]) (nil)))) In one case, choose_reload_regs picks up: Reload 0: reload_in (DI) = (plus:DI (reg/f:DI 12 r12) (const_int 1088 [0x440])) GR_REGS, RELOAD_FOR_OPERAND_ADDRESS (opnum = 0), can't combine reload_in_reg: (plus:DI (reg/f:DI 12 r12) (const_int 1088 [0x440])) reload_reg_rtx: (reg/f:DI 14 r14 [391]) Reload 1: reload_out (DI) = (mem/c/i:DI (plus:DI (reg/f:DI 12 r12) (const_int 1088 [0x440])) [0 nfilt+0 S8 A64]) NO_REGS, RELOAD_FOR_OUTPUT (opnum = 0), optional reload_out_reg: (reg/v/f:DI 388 [ nfilt ]) Reload 2: reload_in (DI) = (mem/c/i:DI (post_inc:DI (reg/f:DI 14 r14 [391])) [0 nfilt+0 S8 A64]) GR_REGS, RELOAD_FOR_INPUT (opnum = 1) reload_in_reg: (mem/c/i:DI (post_inc:DI (reg/f:DI 14 r14 [391])) [0 nfilt+0 S8 A64]) reload_reg_rtx: (reg:DI 15 r15) and with Alan's patch reverted it chooses reload_reg_rtx for reload 0 and 2 r15 and r16 instead. It seems reload is confused by the POST_INC and when it chooses r14 is rld[0].reg_rtx, we get: (insn 611 577 610 2 (set (reg:DI 15 r15) (mem/c/i:DI (post_inc:DI (reg/f:DI 14 r14 [391])) [0 nfilt+0 S8 A64])) 5 {*movdi_internal} (nil) (expr_list:REG_INC (reg/f:DI 14 r14 [391]) (nil))) (insn 610 611 11 2 (set (reg/f:DI 14 r14 [391]) (plus:DI (reg/f:DI 12 r12) (const_int 1088 [0x440]))) 105 {adddi3} (nil) (nil)) (insn 11 610 14 2 (set (mem/c/i:DI (reg/f:DI 14 r14 [391]) [0 nfilt+0 S8 A64]) (reg:DI 15 r15)) 5 {*movdi_internal} (insn_list:REG_DEP_TRUE 577 (nil)) (expr_list:REG_EQUIV (mem/f/c/i:DI (reg/f:DI 0 ap) [0 nfilt+0 S8 A64]) (nil))) (insn 14 11 83 2 (set (reg/v/f:DI 107 loc75 [orig:389 xstart ] [389]) (mem/c/i:DI (reg/f:DI 14 r14 [391]) [0 xstart+0 S8 A64])) 5 {*movdi_internal} (insn_list:REG_DEP_TRUE 11 (insn_list:REG_DEP_TRUE 577 (nil))) (expr_list:REG_EQUIV (mem/f/c/i:DI (plus:DI (reg/f:DI 0 ap) (const_int 8 [0x8])) [0 xstart+0 S8 A64]) (nil))) which is wrong, as r14 should have contained r12 + 1088 + 8 in insn 14, not r12 + 1088. -- jakub at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2006-01-02 13:57:12 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25603