[Bug c++/91270] [10 Regression] ICE in verify_use at gcc/tree-ssa.c:883 since r273791

marxin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Jul 28 08:53:00 GMT 2019


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

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #5)
> 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.

This patch will be better:

diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index cf507fa0453..04338a67181 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -1294,6 +1294,20 @@ eliminate_unnecessary_stmts (void)
                      && !gimple_plf (def_stmt, STMT_NECESSARY))
                    gimple_set_plf (stmt, STMT_NECESSARY, false);
                }
+
+             /* Some delete operators have 2 arguments, where the second
argument is
+                size of the deallocated memory.  */
+             if (gimple_call_num_args (stmt) == 2)
+               {
+                 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.  */


More information about the Gcc-bugs mailing list