+2019-07-29 Martin Liska <mliska@suse.cz>
+
+ * tree-ssa-dce.c (eliminate_unnecessary_stmts): Do not
+ remove LHS of operator new call. It's handled latter.
+
2019-07-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/91267
+2019-07-29 Martin Liska <mliska@suse.cz>
+
+ * g++.dg/cpp1y/new1.C (test_unused): Add new case that causes
+ ICE.
+
2019-07-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/91267
delete [] x;
}
+void
+test_unused() {
+ volatile double d = 0.0;
+ double *p = new double ();
+ d += 1.0;
+ delete p;
+}
+
/* { dg-final { scan-tree-dump-times "Deleting : operator delete" 5 "cddce1"} } */
/* { dg-final { scan-tree-dump-times "Deleting : _\\d+ = operator new" 7 "cddce1"} } */
did not mark as necessary, it will confuse the
special logic we apply to malloc/free pair removal. */
&& (!(call = gimple_call_fndecl (stmt))
- || DECL_BUILT_IN_CLASS (call) != BUILT_IN_NORMAL
- || (DECL_FUNCTION_CODE (call) != BUILT_IN_ALIGNED_ALLOC
- && DECL_FUNCTION_CODE (call) != BUILT_IN_MALLOC
- && DECL_FUNCTION_CODE (call) != BUILT_IN_CALLOC
- && !ALLOCA_FUNCTION_CODE_P
- (DECL_FUNCTION_CODE (call)))))
+ || ((DECL_BUILT_IN_CLASS (call) != BUILT_IN_NORMAL
+ || (DECL_FUNCTION_CODE (call) != BUILT_IN_ALIGNED_ALLOC
+ && DECL_FUNCTION_CODE (call) != BUILT_IN_MALLOC
+ && DECL_FUNCTION_CODE (call) != BUILT_IN_CALLOC
+ && !ALLOCA_FUNCTION_CODE_P
+ (DECL_FUNCTION_CODE (call))))
+ && !DECL_IS_REPLACEABLE_OPERATOR_NEW_P (call))))
{
something_changed = true;
if (dump_file && (dump_flags & TDF_DETAILS))