From patchwork Mon Aug 27 16:25:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 180244 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id DB7DD2C00D5 for ; Tue, 28 Aug 2012 02:25:48 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1346689559; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Mail-Followup-To:Subject:Date:Message-ID: User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=Smj8BiDTfAv/3J3hkj1kT8rsGnA=; b=UTpH/kR6Y1dbF3z Uzx8ab2uZVpUKwWEdFXyQ3DdyEhRxRKgsJhTB4bg2IjQ7DWxx5F1M/iLj6+C1yfp ge2tZO4uZ4xxcxePNDxXLVLTZiZqJHaGdoLHnLPeXemZjEysqEpLvAWqBjmgg3p/ t+GysEYh7evqFe+YD2vprxT6Zy6U= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:From:To:Mail-Followup-To:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=cctNSrP9Gg+OSKtGv1mU3ilYVIAhVR9Xz52Go9uWI15YbZA+pMX+Ckfe94aa1Z 2VqBiH4THzKDYCzNVV2gdEnJUnZlqi+P1LyVcn/YU3Wa/X6v29lX2qJ3yHcWUMbb lJN9LPBlfRJ3RjfHm5XmHACyzpvRpxlo2gjGb9513y1cU=; Received: (qmail 13444 invoked by alias); 27 Aug 2012 16:25:43 -0000 Received: (qmail 13427 invoked by uid 22791); 27 Aug 2012 16:25:39 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-ee0-f47.google.com (HELO mail-ee0-f47.google.com) (74.125.83.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 27 Aug 2012 16:25:26 +0000 Received: by eekb57 with SMTP id b57so1612402eek.20 for ; Mon, 27 Aug 2012 09:25:24 -0700 (PDT) Received: by 10.14.221.197 with SMTP id r45mr15994878eep.41.1346084724902; Mon, 27 Aug 2012 09:25:24 -0700 (PDT) Received: from localhost ([2.26.188.227]) by mx.google.com with ESMTPS id c6sm53713778eep.7.2012.08.27.09.25.19 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 27 Aug 2012 09:25:23 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [MIPS, committed] Fix segfault in vr4130_align_insns Date: Mon, 27 Aug 2012 17:25:21 +0100 Message-ID: <87oblw1evi.fsf@talisman.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This fixes a segfault seen in the fix-vr4130* cases when run with -O3 -mabi=64. The problem was caused by vr4130_align_insns simulating zero-length ghost gp instructions, even though the idea is that the scheduler should ignore them. (These instructions postdate the vr4130 stuff by quite some time.) Tested on mips64-linux-gnu. Applied. Richard gcc/ * config/mips/mips.c (vr4130_align_insns): Don't simulate ghost instructions. Assert that the required instructions exist. Index: gcc/config/mips/mips.c =================================================================== --- gcc/config/mips/mips.c 2012-08-27 16:28:48.068139755 +0100 +++ gcc/config/mips/mips.c 2012-08-27 16:54:59.941094052 +0100 @@ -15145,7 +15145,8 @@ vr4130_align_insns (void) the fly to avoid a separate instruction walk. */ vr4130_avoid_branch_rt_conflict (insn); - if (USEFUL_INSN_P (insn)) + length = get_attr_length (insn); + if (length > 0 && USEFUL_INSN_P (insn)) FOR_EACH_SUBINSN (subinsn, insn) { mips_sim_wait_insn (&state, subinsn); @@ -15180,6 +15181,7 @@ vr4130_align_insns (void) issuing at the same time as the branch. We therefore insert a nop before the branch in order to align its delay slot. */ + gcc_assert (last2); emit_insn_after (gen_nop (), last2); aligned_p = false; } @@ -15188,6 +15190,7 @@ vr4130_align_insns (void) /* SUBINSN is the delay slot of INSN, but INSN is currently unaligned. Insert a nop between LAST and INSN to align it. */ + gcc_assert (last); emit_insn_after (gen_nop (), last); aligned_p = true; }