From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 51437 invoked by alias); 4 Apr 2016 19:28:32 -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 51428 invoked by uid 89); 4 Apr 2016 19:28:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1690 X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 04 Apr 2016 19:28:29 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 40C8F545579; Mon, 4 Apr 2016 21:28:26 +0200 (CEST) Date: Mon, 04 Apr 2016 19:28:00 -0000 From: Jan Hubicka To: Jakub Jelinek Cc: Jan Hubicka , gcc-patches@gcc.gnu.org Subject: Re: Do not optimize some polymorphic calls with -fsanitize=undefined Message-ID: <20160404192826.GA7702@kam.mff.cuni.cz> References: <20160404155052.GA19779@kam.mff.cuni.cz> <20160404182544.GJ19207@tucnak.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160404182544.GJ19207@tucnak.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2016-04/txt/msg00200.txt.bz2 > On Mon, Apr 04, 2016 at 05:50:53PM +0200, Jan Hubicka wrote: > > Hi, > > as requested by Jakub, this patch makes devirtualization code to turn off > > transformations based on assumption that cxa_pure_virtual will never be called > > by a virtual call when -fsanitize=undefined is used. > > > > Bootstrapped/regtested x86_64-linux, will commit it shortly. > > > > PR ipa/66223 > > * ipa-devirt.c (maybe_record_node): Do not optimize cxa_pure_virtual > > calls when sanitizing. > > (possible_polymorphic_call_target_p)" FIx formating. > > > > * g++.dg/ipa/devirt-51.C: New testcase. > > Index: ipa-devirt.c > > =================================================================== > > --- ipa-devirt.c (revision 234715) > > +++ ipa-devirt.c (working copy) > > @@ -2438,10 +2438,14 @@ maybe_record_node (vec & > > { > > gcc_assert (!target_node->global.inlined_to); > > gcc_assert (target_node->real_symbol_p ()); > > + /* When sanitizing, do not asume that cxa_pure_virutal is not called > > s/asume/assume/ > s/cxa/__cxa/ > s/virutal/virtual/ > > > + by valid program. */ > > + if (flag_sanitize & SANITIZE_UNDEFINED) > > + ; > > I'd use SANITIZE_UNREACHABLE instead, that is the sanitizer for > __builtin_unreachable (). Unless we want to split that into > -fsanitize=unreachable > -fsanitize=pure-virtual Thanks. This is about case where we optimize undefined call (which would otherwise land in cxa_pure_virtual) into some other virtual method (that is the only resonable choice). I suppose UNREACHABLE makes sense here. I think I already commited the patch but I will update this. Honza > > Jakub