From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10100 invoked by alias); 11 Sep 2013 14:14:17 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 10032 invoked by uid 48); 11 Sep 2013 14:14:12 -0000 From: "glisse at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/19476] Missed null checking elimination with new Date: Wed, 11 Sep 2013 14:14:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.0.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: glisse at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-09/txt/msg00816.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19476 --- Comment #16 from Marc Glisse --- (In reply to Marc Glisse from comment #15) > However, note that it only optimizes the testcase from this PR if we add > #include at the beginning, otherwise the implicit declaration of > operator new doesn't have its operator_new_flag set... That can (and probably should, since this flag is also used in alias analysis) be fixed with something like: --- /data/repos/gcc/newnonzero/gcc/cp/decl.c (revision 202499) +++ /data/repos/gcc/newnonzero/gcc/cp/decl.c (working copy) @@ -3799,8 +3799,8 @@ 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); - push_cp_library_fn (NEW_EXPR, newtype, 0); - push_cp_library_fn (VEC_NEW_EXPR, newtype, 0); + 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; global_delete_fndecl = push_cp_library_fn (DELETE_EXPR, deltype, ECF_NOTHROW); push_cp_library_fn (VEC_DELETE_EXPR, deltype, ECF_NOTHROW);