public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Marek Polacek <polacek@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [ubsan PATCH] Fix compile-time hog with &TARGET_EXPRs (PR sanitizer/70342)
Date: Thu, 28 Apr 2016 09:07:00 -0000	[thread overview]
Message-ID: <20160428090730.GK26501@tucnak.zalov.cz> (raw)
In-Reply-To: <20160427170325.GK28445@redhat.com>

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  <polacek@redhat.com>
> 
> 	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

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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-27 17:03 Marek Polacek
2016-04-28  9:07 ` Jakub Jelinek [this message]
2016-04-28 14:10   ` Marek Polacek
2016-04-28 14:15     ` Jakub Jelinek
2016-04-29 12:35       ` Marek Polacek

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=20160428090730.GK26501@tucnak.zalov.cz \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=polacek@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).