From patchwork Fri May 20 20:36:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 96666 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 41A5EB71A0 for ; Sat, 21 May 2011 06:36:46 +1000 (EST) Received: (qmail 4890 invoked by alias); 20 May 2011 20:36:44 -0000 Received: (qmail 4822 invoked by uid 22791); 20 May 2011 20:36:43 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD 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; Fri, 20 May 2011 20:36:26 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p4KKaQvE006597 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 20 May 2011 16:36:26 -0400 Received: from [127.0.0.1] (ovpn-113-120.phx2.redhat.com [10.3.113.120]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p4KKaPfe000603 for ; Fri, 20 May 2011 16:36:26 -0400 Message-ID: <4DD6D0C9.1030502@redhat.com> Date: Fri, 20 May 2011 16:36:25 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: gcc-patches List Subject: Re: C++ PATCH for c++/48873 (unnecessary dtor calls in new-expressions) References: <4DC2B9E1.2020200@redhat.com> In-Reply-To: <4DC2B9E1.2020200@redhat.com> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org While thinking about backporting this patch, I noticed a thinko: I was applying SCALAR_TYPE_P to the expression itself, not its type. Oops. Tested x86_64-pc-linux-gnu, applying to trunk. commit 17f3af8efbf2fe2483fd922b42b30585a33095a9 Author: Jason Merrill Date: Fri May 20 16:02:53 2011 -0400 * tree.c (stabilize_expr): Fix typo. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 6b3680e..c93110b 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -3136,7 +3136,7 @@ stabilize_expr (tree exp, tree* initp) /* There are no expressions with REFERENCE_TYPE, but there can be call arguments with such a type; just treat it as a pointer. */ else if (TREE_CODE (TREE_TYPE (exp)) == REFERENCE_TYPE - || SCALAR_TYPE_P (exp) + || SCALAR_TYPE_P (TREE_TYPE (exp)) || !lvalue_or_rvalue_with_address_p (exp)) { init_expr = get_target_expr (exp);