From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 103449 invoked by alias); 30 Jul 2015 04:50:11 -0000 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 Received: (qmail 103397 invoked by uid 48); 30 Jul 2015 04:50:06 -0000 From: "kkojima at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/67061] sh64-elf: internal compiler error: in sh_find_set_of_reg, at config/sh/sh-protos.h:235 Date: Thu, 30 Jul 2015 04:50: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-Version: 5.2.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: kkojima at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-07/txt/msg02605.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67061 --- Comment #2 from Kazumoto Kojima --- (In reply to Oleg Endo from comment #1) > Hm .. > > for (result.insn = stepfunc (insn); result.insn != NULL_RTX; > previnsn = result.insn, result.insn = stepfunc (result.insn)) > > that "previnsn = ... " in sh_find_set_of_reg looks broken. I wonder how/why > it never showed up for normal SH targets (normal = non-SH64). I'll have a > look at this. SHCOMPACT target uses different ABI for the function calls. It looks that that makes sh_find_set_of_reg unhappy. k_cos.c case is here: ... (call_insn/i 29 28 30 3 (parallel [ (set (reg:SI 2 r2) (call (mem:SI (reg/f:SI 509) [0 S4 A32]) (const_int 0 [0]))) (const_int 1610612736 [0x60000000]) (use (reg:SI 0 r0)) (use (reg:SI 1 r1)) (use (reg:SI 154 fpscr0)) (clobber (reg:SI 146 pr)) ]) ...k_cos.c:78 323 {call_value_compact} (expr_list:REG_DEAD (reg:SI 154 fpscr0) (expr_list:REG_DEAD (reg:SI 1 r1) (expr_list:REG_DEAD (reg:SI 0 r0) (expr_list:REG_CALL_DECL (symbol_ref:SI ("__fixdfsi") [flags 0x41]) (expr_list:REG_EH_REGION (const_int -2147483648 [0xffffffff80000000]) (nil)))))) (expr_list (use (reg:SI 2 r2)) (expr_list (use (mem/c:DF (reg/f:SI 508) [1 S8 A64])) (nil)))) (note 30 29 31 3 NOTE_INSN_DELETED) (insn 31 30 32 3 (set (reg:SI 147 t) (eq:SI (reg:SI 2 r2) (const_int 0 [0]))) ...k_cos.c:78 12 {cmpeqsi_t} (expr_list:REG_DEAD (reg:SI 2 r2) (nil))) ... and the problem happens at the call of sh_find_set_of_reg Breakpoint 2, sh_find_extending_set_of_reg (reg=0xb7e95e24, curr_insn=curr_insn@entry=0xb7e99480) at /exp/ldroot/dodes/xsh64-elf-combined/combined/gcc/config/sh/sh.c:13925 13925 sh_find_set_of_reg (reg, curr_insn, prev_nonnote_insn_bb, true); where reg is r2 and curr_insn is the insn 31. sh_find_set_of_reg is stepping backward from the insn 31 but the call_insn 29 is missed. Does the patch below work? Oleg, it's the same one we've discussed, I think. Thought? diff --git a/config/sh/sh-protos.h b/config/sh/sh-protos.h index 5a552e2..3b725ba 100644 --- a/config/sh/sh-protos.h +++ b/config/sh/sh-protos.h @@ -198,7 +198,8 @@ sh_find_set_of_reg (rtx reg, rtx_insn* insn, F stepfunc, { if (BARRIER_P (result.insn)) break; - if (!NONJUMP_INSN_P (result.insn)) + if (!NONJUMP_INSN_P (result.insn) + && !(REGNO (reg) < FIRST_PSEUDO_REGISTER && CALL_P (result.insn))) continue; if (reg_set_p (reg, result.insn)) {