https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91270

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ice during GIMPLE pass: dce |[10 Regression] ICE in
                   |                            |verify_use at
                   |                            |gcc/tree-ssa.c:883 since
                   |                            |r273791

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
I've got a patch candidate:

diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index cf507fa0453..bdaad09ef35 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -1294,6 +1294,21 @@ eliminate_unnecessary_stmts (void)
                      && !gimple_plf (def_stmt, STMT_NECESSARY))
                    gimple_set_plf (stmt, STMT_NECESSARY, false);
                }
+
+             /* Delete operator has 2 arguments, where the second argument is
+                size of the deallocated memory.  */
+             if (is_gimple_call (stmt)
+                 && gimple_call_operator_delete_p (as_a <gcall *> (stmt)))
+               {
+                 tree ptr = gimple_call_arg (stmt, 1);
+                 if (TREE_CODE (ptr) == SSA_NAME)
+                   {
+                     gimple *def_stmt = SSA_NAME_DEF_STMT (ptr);
+                     if (!gimple_nop_p (def_stmt)
+                         && !gimple_plf (def_stmt, STMT_NECESSARY))
+                       gimple_set_plf (stmt, STMT_NECESSARY, false);
+                   }
+               }
            }

          /* If GSI is not necessary then remove it.  */

I'll finish it tomorrow morning and send it to mailing list.

Reply via email to