From patchwork Mon Oct 6 13:14:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 396804 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D7BEF1400EA for ; Tue, 7 Oct 2014 00:14:52 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; q=dns; s=default; b=i7BakeWJZ8t2Zd93 OX7680OHx1Qp3euxeQLTU2WHqPwR74chtpCQw0DCeKGP89O8vZHf14rkMAjdoDbA ITrl+2MeM/5kCoD/htH2CCmYuAvl+r3O4UEPdeFtqMu7Pebu4pHHzhm4neIw7Mho HTEnHBYfZPB+l/GgoF7OZBtjm5A= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; s=default; bh=jLp+m1+Cj7o7nn6Orzeok0 7kqAM=; b=IQJANSZOtqFL+aH02kMZS+8YaXsfmnbhAXFdr5Tqw8PAbbCF8WTpVG sN09w5+PyhWh6wFZ2bLaEwxo7Rfi2FqBeIiZb/ndLHhKvf/1RzLy5TadEshQ0xl4 na56pVV5+rw1uxkUXWQy2ynJEOT5VBOOUTMhfLUbE78+arP9CWYLc= Received: (qmail 25794 invoked by alias); 6 Oct 2014 13:14:42 -0000 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 Received: (qmail 25783 invoked by uid 89); 6 Oct 2014 13:14:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00, KAM_STOCKGEN, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: smtp-relay.CeBiTec.Uni-Bielefeld.DE Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 06 Oct 2014 13:14:40 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 35675BC2; Mon, 6 Oct 2014 15:14:38 +0200 (CEST) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 17jHHd7ac-qX; Mon, 6 Oct 2014 15:14:35 +0200 (CEST) Received: from lokon.CeBiTec.Uni-Bielefeld.DE (lokon.CeBiTec.Uni-Bielefeld.DE [129.70.161.110]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 83E50BC1; Mon, 6 Oct 2014 15:14:35 +0200 (CEST) Received: (from ro@localhost) by lokon.CeBiTec.Uni-Bielefeld.DE (8.14.7+Sun/8.14.7/Submit) id s96DEZud026845; Mon, 6 Oct 2014 15:14:35 +0200 (MEST) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: rdsandiford@googlemail.com Subject: Re: RFA: Merge definitions of get_some_local_dynamic_name References: <87bnqxna3y.fsf@googlemail.com> <87ppf6x9d9.fsf@googlemail.com> <87d2b4y6wk.fsf@googlemail.com> Date: Mon, 06 Oct 2014 15:14:35 +0200 In-Reply-To: <87d2b4y6wk.fsf@googlemail.com> (Richard Sandiford's message of "Tue, 09 Sep 2014 19:40:11 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes Hi Richard, > Rainer Orth writes: >> Hi Richard, >>>> It seems the new get_some_local_dynamic_name implementation in >>>> function.c lost the non-NULL check the sparc.c version had. I'm >>>> currently testing the following patch: >>> >>> Could you do a: >>> >>> call debug_rtx (...) >>> >>> on the insn that contains a null pointer? Normally insn patterns >>> shouldn't contain nulls, so I was wondering whether this was some >>> SPARC-specific construct. >> >> proved a bit difficult to do: at the default -O2, insn was optimized >> away, at -g3 -O0, I only got >> >> can't compute CFA for this frame >> >> with gdb 7.8 even after recompiling all of the gcc dir with -g3 -O0. >> >> Here's what I find after inserting the call in the source: >> >> (insn 30 6 28 (sequence [ >> (call_insn:TI 8 6 7 (parallel [ >> (set (reg:SI 8 %o0) >> (call (mem:SI (unspec:SI [ >> (symbol_ref:SI ("__tls_get_addr")) >> ] UNSPEC_TLSLDM) [0 S4 A32]) >> (const_int 1 [0x1]))) >> (clobber (reg:SI 15 %o7)) >> ]) /vol/gcc/src/hg/trunk/local/libgo/runtime/proc.c:936 390 {tldm_call32} >> (expr_list:REG_EH_REGION (const_int -2147483648 [0xffffffff80000000]) >> (nil)) >> (expr_list (use (reg:SI 8 %o0)) >> (nil))) >> (insn 7 8 28 (set (reg:SI 8 %o0) >> (plus:SI (reg:SI 23 %l7) >> (unspec:SI [ >> (reg:SI 8 %o0 [112]) >> ] UNSPEC_TLSLDM))) 388 {tldm_add32} >> (nil)) >> ]) /vol/gcc/src/hg/trunk/local/libgo/runtime/proc.c:936 -1 >> (nil)) > > Bah, a sequence. Hadn't thought of that. > > IMO it's a bug for a walk on a PATTERN to pull in non-PATTERN parts > of an insn. We should really be looking at the patterns of the two > subinsns instead and ignore the other stuff. Let me have a think > about it. did you come to a conclusion here? > Now that we know the underlying cause, I personally wouldn't mind the > null check being committed as a workaround. If you do though, please > could you add a comment saying that this is for SEQUENCEs? I've had the following in my local tree for some weeks now to keep SPARC bootstrap working: 2014-10-06 Rainer Orth * final.c (get_some_local_dynamic_name): Guard against NULL const_rtx. Rainer # HG changeset patch # Parent 5768379d027521837a7be746630c3f53cc5bce83 Fix SPARC bootstrap: get_some_local_dynamic_name diff --git a/gcc/final.c b/gcc/final.c --- a/gcc/final.c +++ b/gcc/final.c @@ -1739,7 +1739,8 @@ get_some_local_dynamic_name () FOR_EACH_SUBRTX (iter, array, PATTERN (insn), ALL) { const_rtx x = *iter; - if (GET_CODE (x) == SYMBOL_REF) + /* NULL check to guard against SEQUENCEs. */ + if (x && GET_CODE (x) == SYMBOL_REF) { if (SYMBOL_REF_TLS_MODEL (x) == TLS_MODEL_LOCAL_DYNAMIC) return some_local_dynamic_name = XSTR (x, 0);