On Tue, Jul 30, 2019 at 10:07 AM Martin Liška <mli...@suse.cz> wrote: > > On 7/30/19 9:46 AM, Martin Liška wrote: > > Anyway that's not a candidate for DCE. I'm testing following patch. > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > One alternative approach can be to drop DECL_SET_IS_OPERATOR_DELETE in: > cat -n gcc/cp/decl.c | less > ... > 4410 deltype = cp_build_type_attribute_variant (deltype, > extvisattr); > 4411 deltype = build_exception_variant (deltype, > empty_except_spec); > 4412 opdel = push_cp_library_fn (DELETE_EXPR, deltype, > ECF_NOTHROW); > 4413 DECL_SET_IS_OPERATOR_DELETE (opdel, true); > 4414 opdel = push_cp_library_fn (VEC_DELETE_EXPR, deltype, > ECF_NOTHROW); > 4415 DECL_SET_IS_OPERATOR_DELETE (opdel, true); > 4416 > 4417 if (flag_sized_deallocation) > 4418 { > 4419 /* operator delete (void *, size_t, align_val_t); */ > 4420 deltype = build_function_type_list (void_type_node, > ptr_type_node, > 4421 size_type_node, > align_type_node, > 4422 NULL_TREE); > 4423 deltype = cp_build_type_attribute_variant (deltype, > extvisattr); > 4424 deltype = build_exception_variant (deltype, > empty_except_spec); > 4425 opdel = push_cp_library_fn (DELETE_EXPR, deltype, > ECF_NOTHROW); > 4426 DECL_SET_IS_OPERATOR_DELETE (opdel, true); > 4427 opdel = push_cp_library_fn (VEC_DELETE_EXPR, deltype, > ECF_NOTHROW); > 4428 DECL_SET_IS_OPERATOR_DELETE (opdel, true); > 4429 } > 4430 } > > at lines 4426 and 4428. > > Richi what do you prefer?
I don't understand why a "not simple" delete operator isn't fine to be DCEd? Does C++ somehow allow mismatching size specifications here? And what's the semantics then? Thus I'd rather go with your earlier patch to mark the op necessary. Richard. > Martin