Commit fc5e7d2a by Martin Liska Committed by Martin Liska

Fix ICE seen in tree-ssa-dce.c for new/delete pair.

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  Martin Liska  <mliska@suse.cz>

	* g++.dg/cpp1y/new1.C (test_unused): Add new case that causes
	ICE.

From-SVN: r273875
parent 3c2f6fae
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> 2019-07-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/91267 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> 2019-07-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/91267 PR tree-optimization/91267
......
...@@ -61,5 +61,13 @@ new_array_load() { ...@@ -61,5 +61,13 @@ new_array_load() {
delete [] x; 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 : operator delete" 5 "cddce1"} } */
/* { dg-final { scan-tree-dump-times "Deleting : _\\d+ = operator new" 7 "cddce1"} } */ /* { dg-final { scan-tree-dump-times "Deleting : _\\d+ = operator new" 7 "cddce1"} } */
...@@ -1364,12 +1364,13 @@ eliminate_unnecessary_stmts (void) ...@@ -1364,12 +1364,13 @@ eliminate_unnecessary_stmts (void)
did not mark as necessary, it will confuse the did not mark as necessary, it will confuse the
special logic we apply to malloc/free pair removal. */ special logic we apply to malloc/free pair removal. */
&& (!(call = gimple_call_fndecl (stmt)) && (!(call = gimple_call_fndecl (stmt))
|| DECL_BUILT_IN_CLASS (call) != BUILT_IN_NORMAL || ((DECL_BUILT_IN_CLASS (call) != BUILT_IN_NORMAL
|| (DECL_FUNCTION_CODE (call) != BUILT_IN_ALIGNED_ALLOC || (DECL_FUNCTION_CODE (call) != BUILT_IN_ALIGNED_ALLOC
&& DECL_FUNCTION_CODE (call) != BUILT_IN_MALLOC && DECL_FUNCTION_CODE (call) != BUILT_IN_MALLOC
&& DECL_FUNCTION_CODE (call) != BUILT_IN_CALLOC && DECL_FUNCTION_CODE (call) != BUILT_IN_CALLOC
&& !ALLOCA_FUNCTION_CODE_P && !ALLOCA_FUNCTION_CODE_P
(DECL_FUNCTION_CODE (call))))) (DECL_FUNCTION_CODE (call))))
&& !DECL_IS_REPLACEABLE_OPERATOR_NEW_P (call))))
{ {
something_changed = true; something_changed = true;
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment