From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 98691 invoked by alias); 28 Apr 2016 09:07:38 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 98675 invoked by uid 89); 28 Apr 2016 09:07:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=!decl_p, !DECL_P X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 28 Apr 2016 09:07:36 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0579F34558C for ; Thu, 28 Apr 2016 09:07:35 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-113-135.phx2.redhat.com [10.3.113.135]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3S97Xxn017517 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 28 Apr 2016 05:07:34 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id u3S97VQ4001024; Thu, 28 Apr 2016 11:07:32 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id u3S97U1H001023; Thu, 28 Apr 2016 11:07:30 +0200 Date: Thu, 28 Apr 2016 09:07:00 -0000 From: Jakub Jelinek To: Marek Polacek Cc: GCC Patches Subject: Re: [ubsan PATCH] Fix compile-time hog with &TARGET_EXPRs (PR sanitizer/70342) Message-ID: <20160428090730.GK26501@tucnak.zalov.cz> Reply-To: Jakub Jelinek References: <20160427170325.GK28445@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160427170325.GK28445@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2016-04/txt/msg01764.txt.bz2 On Wed, Apr 27, 2016 at 07:03:25PM +0200, Marek Polacek wrote: > This test took forever to compile with -fsanitize=null, because the > instrumentation was creating incredible amount of duplicated expressions, in a > quadratic fashion. I think the problem is that we instrument &TARGET_EXPR <> > expressions, which doesn't seem to be needed -- we only need to instrument the > initializers in TARGET_EXPRs. With this patch, we avoid creating tons of useless > expressions and the compile time is reduced from ~ infinity to <1s. > > Jakub, do you see any problem with this? > > Bootstrapped/regtested on x86_64-linux, ok for trunk? > > 2016-04-27 Marek Polacek > > PR sanitizer/70342 > * c-ubsan.c (ubsan_maybe_instrument_reference_or_call): Don't > null-instrument &TARGET_EXPR <...>. > > * g++.dg/ubsan/null-7.C: New test. I wonder if this wouldn't be better handled in tree_single_nonzero_warnv_p, perhaps like: case ADDR_EXPR: { tree base = TREE_OPERAND (t, 0); if (!DECL_P (base)) base = get_base_address (base); + + if (base && TREE_CODE (base) == TARGET_EXPR) + base = TARGET_EXPR_SLOT (base); if (!base) return false; (untested)? Jakub