From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21651 invoked by alias); 3 Oct 2012 09:43:29 -0000 Received: (qmail 21640 invoked by uid 22791); 3 Oct 2012 09:43:28 -0000 X-SWARE-Spam-Status: No, hits=-7.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 03 Oct 2012 09:43:18 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q939hHHr022621 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 3 Oct 2012 05:43:18 -0400 Received: from zalov.redhat.com (vpn1-4-138.ams2.redhat.com [10.36.4.138]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q939hGHE006234 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 3 Oct 2012 05:43:17 -0400 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.redhat.com (8.14.5/8.14.5) with ESMTP id q939hF3p013609; Wed, 3 Oct 2012 11:43:15 +0200 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id q939hFWe013608; Wed, 3 Oct 2012 11:43:15 +0200 Date: Wed, 03 Oct 2012 09:43:00 -0000 From: Jakub Jelinek To: Dodji Seketeli Cc: Jason Merrill , gcc-patches@gcc.gnu.org Subject: Re: [C++ PATCH] -Wsizeof-pointer-memaccess warning (take 2) Message-ID: <20121003094314.GQ1787@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <20120816191535.GM1999@tucnak.redhat.com> <5059CF5F.4030308@redhat.com> <20120925153640.GM1787@tucnak.redhat.com> <20121002125629.GJ1787@tucnak.redhat.com> <877gr7nchu.fsf@seketeli.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <877gr7nchu.fsf@seketeli.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 X-SW-Source: 2012-10/txt/msg00254.txt.bz2 On Wed, Oct 03, 2012 at 11:14:37AM +0200, Dodji Seketeli wrote: > Jakub Jelinek 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