From patchwork Wed Oct 26 09:15:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 121867 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 52A7FB6F68 for ; Wed, 26 Oct 2011 20:16:42 +1100 (EST) Received: (qmail 24003 invoked by alias); 26 Oct 2011 09:16:36 -0000 Received: (qmail 23994 invoked by uid 22791); 26 Oct 2011 09:16:35 -0000 X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, SPF_HELO_PASS, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 26 Oct 2011 09:16:08 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9Q9FVv3007848 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 26 Oct 2011 05:15:31 -0400 Received: from freie.oliva.athome.lsd.ic.unicamp.br (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p9Q9FRLH020413 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 26 Oct 2011 05:15:30 -0400 Received: from livre.localdomain (livre-to-gw.oliva.athome.lsd.ic.unicamp.br [172.31.160.19]) by freie.oliva.athome.lsd.ic.unicamp.br (8.14.4/8.14.4) with ESMTP id p9Q9FOXa008155; Wed, 26 Oct 2011 07:15:25 -0200 Received: from livre.localdomain (aoliva@localhost.localdomain [127.0.0.1]) by livre.localdomain (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p9Q9FNLt024192; Wed, 26 Oct 2011 07:15:23 -0200 Received: (from aoliva@localhost) by livre.localdomain (8.14.3/8.14.3/Submit) id p9Q9FKNZ024190; Wed, 26 Oct 2011 07:15:20 -0200 From: Alexandre Oliva To: sje@cup.hp.com Cc: Jakub Jelinek , Jan Kratochvil , gcc-patches@gcc.gnu.org, Richard Guenther , dave.anglin@bell.net Subject: Re: [patch] dwarf2out crash: missing GTY? (PR 50806) References: <20111020103511.GK2210@tyan-ft48-01.lab.bos.redhat.com> <201110211654.p9LGsuC01435@adlwrk05.cce.hp.com> <20111021192526.GY2210@tyan-ft48-01.lab.bos.redhat.com> <1319230221.20295.799.camel@hpsje.cup.hp.com> Date: Wed, 26 Oct 2011 07:15:20 -0200 In-Reply-To: <1319230221.20295.799.camel@hpsje.cup.hp.com> (Steve Ellcey's message of "Fri, 21 Oct 2011 13:50:21 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (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 On Oct 21, 2011, Steve Ellcey wrote: > On Fri, 2011-10-21 at 21:25 +0200, Jakub Jelinek wrote: >> My guess would be >> http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180194 >> DEBUG_EXPR certainly shouldn't make it through into mem_loc_descriptor, >> var-tracking is supposed to resolve that. >> >> Jakub > You are right, the bug started at r180194. I have submitted a bug (PR > 50826) which includes a cut down test case for the problem. Thanks for testing this patch on the affected platform. I also bootstrapped it on {x86_64,i686}-linux-gnu, with and without an additional patch that looked for debug_exprs in any loc expr associated with multi-part variables. That didn't get any hits, so I ended up finding out it is the use of a pseudo to hold the internal_arg_pointer that leads to a chain of events that results in a debug temp bound to a hard reg ending up used in MEM addresses of incoming args referenced in the exprs of other debug temps. (more details in the bug report) Ok to install? for gcc/ChangeLog from Alexandre Oliva PR debug/50826 * var-tracking.c (rtx_debug_expr_p): New. (use_type): Don't use debug exprs to track non-VTA variables. Index: gcc/var-tracking.c =================================================================== --- gcc/var-tracking.c.orig 2011-10-25 02:02:25.588540417 -0200 +++ gcc/var-tracking.c 2011-10-25 02:02:29.655480746 -0200 @@ -4907,6 +4907,18 @@ replace_expr_with_values (rtx loc) return cselib_subst_to_values (loc, VOIDmode); } +/* Return true if *X is a DEBUG_EXPR. Usable as an argument to + for_each_rtx to tell whether there are any DEBUG_EXPRs within + RTX. */ + +static int +rtx_debug_expr_p (rtx *x, void *data ATTRIBUTE_UNUSED) +{ + rtx loc = *x; + + return GET_CODE (loc) == DEBUG_EXPR; +} + /* Determine what kind of micro operation to choose for a USE. Return MO_CLOBBER if no micro operation is to be generated. */ @@ -4988,7 +5000,13 @@ use_type (rtx loc, struct count_use_info else if (target_for_debug_bind (var_debug_decl (expr))) return MO_CLOBBER; else if (track_loc_p (loc, expr, INT_MEM_OFFSET (loc), - false, modep, NULL)) + false, modep, NULL) + /* Multi-part variables shouldn't refer to one-part + variable names such as VALUEs (never happens) or + DEBUG_EXPRs (only happens in the presence of debug + insns). */ + && (!MAY_HAVE_DEBUG_INSNS + || !for_each_rtx (&XEXP (loc, 0), rtx_debug_expr_p, NULL))) return MO_USE; else return MO_CLOBBER;