From patchwork Fri Apr 11 18:17:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 338607 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 67A561400E1 for ; Sat, 12 Apr 2014 04:18:08 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=Ds1p4SPB9mwxenXYPUiMEvovpFKbqbseNzZMlNOKabyM59 XsEnA2OFewhykaFZt/eK23qIDKnV+1xgO+vHK2mP5AHupHl4FCfq8hQ4JGgqUH1y nwhADGu9viyMEllsdJKqPBRsd5lQlO3bfA4rpW2P0Ta391AiayU2KEHI5hkpQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=QLTJdSJRKU/w7yzR3IkJUqpKEIc=; b=k7mvlhrlHT0Obpbnj1m9 hDV5A17fWLnksAzksbD08PVE08UVZuhKbhq0W/2AMoN9vQ5fV48qFDF3YO9FvWj4 t3N1Z1EUHj5zce85BGjX5GZGk1HxlMUE0tu0rh+mVNCriPK8RzuvsPyq/Gv0THmh h9i3IHyJAdVGkl4WuM9pHGM= Received: (qmail 18339 invoked by alias); 11 Apr 2014 18:18:01 -0000 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 Received: (qmail 18320 invoked by uid 89); 11 Apr 2014 18:18:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 Apr 2014 18:18:00 +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 s3BIHwl1009082 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 11 Apr 2014 14:17:58 -0400 Received: from [10.10.116.16] ([10.10.116.16]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s3BIHwQn031361 for ; Fri, 11 Apr 2014 14:17:58 -0400 Message-ID: <534831D5.7000207@redhat.com> Date: Fri, 11 Apr 2014 14:17:57 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for DR 1338 (operator new aliasing) At the last C++ meeting I got the committee to accept wording that ought to allow us to set DECL_IS_MALLOC on the built-in operator new: Furthermore, for the library allocation functions in 18.6.1.1 [new.delete.single] and 18.6.1.2 [new.delete.array], p0 shall point to a block of storage disjoint from the storage for any other object accessible to the caller. Tested x86_64-pc-linux-gnu, applying to trunk. commit decb849d1c9670c5e5cd07e1bea776244ae9a9d2 Author: Jason Merrill Date: Tue Feb 18 09:15:02 2014 -0500 DR 1338 * decl.c (cxx_init_decl_processing): Set DECL_IS_MALLOC on built-in operator new. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 3400594..069b374 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -3847,8 +3847,12 @@ cxx_init_decl_processing (void) newtype = build_exception_variant (newtype, new_eh_spec); deltype = cp_build_type_attribute_variant (void_ftype_ptr, extvisattr); deltype = build_exception_variant (deltype, empty_except_spec); - DECL_IS_OPERATOR_NEW (push_cp_library_fn (NEW_EXPR, newtype, 0)) = 1; - DECL_IS_OPERATOR_NEW (push_cp_library_fn (VEC_NEW_EXPR, newtype, 0)) = 1; + tree opnew = push_cp_library_fn (NEW_EXPR, newtype, 0); + DECL_IS_MALLOC (opnew) = 1; + DECL_IS_OPERATOR_NEW (opnew) = 1; + opnew = push_cp_library_fn (VEC_NEW_EXPR, newtype, 0); + DECL_IS_MALLOC (opnew) = 1; + DECL_IS_OPERATOR_NEW (opnew) = 1; global_delete_fndecl = push_cp_library_fn (DELETE_EXPR, deltype, ECF_NOTHROW); push_cp_library_fn (VEC_DELETE_EXPR, deltype, ECF_NOTHROW);