public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Dodji Seketeli <dodji@seketeli.org>
Cc: Jason Merrill <jason@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: [C++ PATCH] -Wsizeof-pointer-memaccess warning (take 2)
Date: Wed, 03 Oct 2012 09:43:00 -0000	[thread overview]
Message-ID: <20121003094314.GQ1787@tucnak.redhat.com> (raw)
In-Reply-To: <877gr7nchu.fsf@seketeli.org>

On Wed, Oct 03, 2012 at 11:14:37AM +0200, Dodji Seketeli wrote:
> Jakub Jelinek <jakub@redhat.com> a écrit:
> 
> > --- gcc/cp/call.c.jj	2012-09-27 12:45:49.000000000 +0200
> > +++ gcc/cp/call.c	2012-10-01 17:53:17.594609236 +0200
> > @@ -557,7 +557,10 @@ null_ptr_cst_p (tree t)
> >      {
> >        /* Core issue 903 says only literal 0 is a null pointer constant.  */
> >        if (cxx_dialect < cxx0x)
> > -	t = integral_constant_value (t);
> > +	{
> > +	  t = integral_constant_value (t);
> > +	  t = maybe_constant_value (t);
> > +	}
> 
> Just for my education, why couldn't maybe_constant_value just call
> integral_constant_value, so that we just use maybe_constant_value here?

Perhaps maybe_constant_value already does all that integral_constant_value
does, but I'm not sure about it.  maybe_constant_value starts with a lot of
conditions where it doesn't do anything if they are true,
integral_constant_value doesn't have any such conditions, on the other side
performs far less - just loops through DECL_INITIAL values looking for a
const.  As I said earlier, while the initial hacks around early folding
of SIZEOF_EXPR were quite ugly, the amount of changes to allow late folding
of SIZEOF_EXPR was huge, with user visible changes etc.

	Jakub

  reply	other threads:[~2012-10-03  9:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-16 19:20 [C++ PATCH] -Wsizeof-pointer-memaccess warning Jakub Jelinek
2012-09-19 13:58 ` Jason Merrill
2012-09-25 16:28   ` Jakub Jelinek
2012-10-02 12:57     ` [C++ PATCH] -Wsizeof-pointer-memaccess warning (take 2) Jakub Jelinek
2012-10-03  9:14       ` Dodji Seketeli
2012-10-03  9:43         ` Jakub Jelinek [this message]
2012-10-05 13:45       ` Jason Merrill
2012-10-11  0:41       ` Hans-Peter Nilsson
2012-10-11 11:54         ` Committed, PR54897 (was: [C++ PATCH] -Wsizeof-pointer-memaccess warning (take 2)) Hans-Peter Nilsson
2012-10-26 13:36       ` [C++ PATCH] -Wsizeof-pointer-memaccess warning (take 2) Roman Zhuykov

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=20121003094314.GQ1787@tucnak.redhat.com \
    --to=jakub@redhat.com \
    --cc=dodji@seketeli.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@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).