From patchwork Fri Dec 7 21:59:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Ellcey X-Patchwork-Id: 204614 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 7F7AA2C0106 for ; Sat, 8 Dec 2012 08:59:17 +1100 (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=1355522358; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:From:Date:To:Subject:User-Agent:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-ID:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=eRQ0n7Vse90xeSXZm0xv9g+0/bU=; b=Jc7Z+tjnwHN5xpwzdF8tX3qRVeLDG0X/LT9jM6UxK1GeotHEtaVzJ9lTowsEwO WZICS6KTk3ALF4zk5lR/Heauc/l8Al8Ol89H9FTuT/g2O5RPFeHwOVWQ9AXpMSBU Hetl4p8y7+/qvaPKI0MuwfkuWdLu9sTpI0UdAwTdXLBpk= 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:X-M-MSG:Received:Received:Received:From:Date:To:Subject:User-Agent:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID:X-EMS-Proccessed:X-EMS-STAMP:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=LlqpeqtG5v3l2x1x0GsZ4tQdw64LM3P4qtWI3a0KqpPL+/WGkubALs13YbXNJF 19RWoZgAsAuqgnGGt+nOoGqlerjgzy1WiKZvLGifk2oQlSKKfbv3YYC2OfKuPZen t2OgT7Zk7yoEFbefrxw9c6RG5YLct6yY7QnUDrwUkBHQY=; Received: (qmail 18055 invoked by alias); 7 Dec 2012 21:59:11 -0000 Received: (qmail 18046 invoked by uid 22791); 7 Dec 2012 21:59:10 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, KHOP_SPAMHAUS_DROP, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from dns1.mips.com (HELO dns1.mips.com) (12.201.5.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 07 Dec 2012 21:59:07 +0000 Received: from mailgate1.mips.com (mailgate1.mips.com [12.201.5.111]) by dns1.mips.com (8.13.8/8.13.8) with ESMTP id qB7Lx5SN006356 for ; Fri, 7 Dec 2012 13:59:05 -0800 X-M-MSG: Received: from exchdb01.mips.com (unknown [192.168.36.84]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mailgate1.mips.com (Postfix) with ESMTP id 27A6B364657 for ; Fri, 7 Dec 2012 13:59:05 -0800 (PST) Received: from ubuntu-sellcey.mips.com (192.168.65.53) by exchhub01.mips.com (192.168.36.84) with Microsoft SMTP Server id 14.1.270.1; Fri, 7 Dec 2012 13:59:00 -0800 Received: by ubuntu-sellcey.mips.com (sSMTP sendmail emulation); Fri, 07 Dec 2012 13:59:00 -0800 From: "Steve Ellcey " Date: Fri, 7 Dec 2012 13:59:00 -0800 To: Subject: [patch, mips, debug] Fix PR 54061, mips compiler aborts in testsuite User-Agent: Heirloom mailx 12.4 7/29/08 MIME-Version: 1.0 Message-ID: X-EMS-Proccessed: 6LP3oGfGVdcdb8o1aBnt6w== X-EMS-STAMP: LZCVTsLIKRTMVzdX5INFtg== 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 is my attempt to fix PR 54061, a bug where GCC aborts while trying to put out debug information for a co-processor register. My understanding is that gdb cannot access the coprocessor registers and so there is no valid debug information that can be put out for this case. So my fix is to remove the assert from dbx_reg_number and change the callers to check for a INVALID_REGNUM value coming from dbx_reg_number. If they get this value then they do not put out any debug information for the register. I have tested this on gcc.c-torture/compile/mipscop-[1234].c and it fixes the abort. I haven't done a full regression test but will do that shortly, in the mean time I wanted to see if this approach was considered acceptable and if not, how I should fix it? Steve Ellcey sellcey@mips.com 2012-12-07 Steve Ellcey PR target/54061 * dwarfwout.c (dbx_reg_number): Remove assert. (reg_loc_descriptor): Check for INVALID_REGNUM. (mem_loc_descriptor): Ditto. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index f0256ae..7d26e7e 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -10438,7 +10438,6 @@ dbx_reg_number (const_rtx rtl) #endif regno = DBX_REGISTER_NUMBER (regno); - gcc_assert (regno != INVALID_REGNUM); return regno; } @@ -10473,6 +10472,9 @@ reg_loc_descriptor (rtx rtl, enum var_init_status initialized) if (REGNO (rtl) >= FIRST_PSEUDO_REGISTER) return 0; + if (dbx_reg_number(rtl) == INVALID_REGNUM) + return 0; + /* We only use "frame base" when we're sure we're talking about the post-prologue local stack frame. We do this by *not* running register elimination until this point, and recognizing the special @@ -11931,6 +11933,8 @@ mem_loc_descriptor (rtx rtl, enum machine_mode mode, break; if (REGNO (rtl) > FIRST_PSEUDO_REGISTER) break; + if (dbx_reg_number (rtl) == INVALID_REGNUM) + break; type_die = base_type_for_mode (mode, GET_MODE_CLASS (mode) == MODE_INT); if (type_die == NULL) @@ -12133,6 +12137,9 @@ mem_loc_descriptor (rtx rtl, enum machine_mode mode, return NULL; if (REG_P (ENTRY_VALUE_EXP (rtl))) { + if (dbx_reg_number (ENTRY_VALUE_EXP (rtl)) == INVALID_REGNUM) + return NULL; + if (GET_MODE_CLASS (mode) != MODE_INT || GET_MODE_SIZE (mode) > DWARF2_ADDR_SIZE) op0 = mem_loc_descriptor (ENTRY_VALUE_EXP (rtl), mode,