public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Jan Hubicka <hubicka@ucw.cz>, gcc-patches@gcc.gnu.org
Subject: Re: Do not optimize some polymorphic calls with -fsanitize=undefined
Date: Mon, 04 Apr 2016 19:28:00 -0000	[thread overview]
Message-ID: <20160404192826.GA7702@kam.mff.cuni.cz> (raw)
In-Reply-To: <20160404182544.GJ19207@tucnak.redhat.com>

> 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 <cgraph_node *> &
> >      {
> >        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

  reply	other threads:[~2016-04-04 19:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-04 15:50 Jan Hubicka
2016-04-04 18:25 ` Jakub Jelinek
2016-04-04 19:28   ` Jan Hubicka [this message]
2016-04-05 21:00   ` Jan Hubicka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160404192826.GA7702@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).