http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19476

--- Comment #16 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Marc Glisse from comment #15)
> However, note that it only optimizes the testcase from this PR if we add
> #include <new> 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);

Reply via email to