gcc/backport-fix-ICE-during-GIMPLE-pass-dse.patch

18 lines
723 B
Diff

diff -Nurp a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
--- a/gcc/tree-ssa-dse.c 2020-09-09 15:47:21 084000000 +800
+++ b/gcc/tree-ssa-dse.c 2020-09-09 15:47:34 740000000 +800
@@ -119,10 +119,11 @@ initialize_ao_ref_for_dse (gimple *stmt,
{
tree nelem = gimple_call_arg (stmt, 0);
tree selem = gimple_call_arg (stmt, 1);
+ tree lhs;
if (TREE_CODE (nelem) == INTEGER_CST
- && TREE_CODE (selem) == INTEGER_CST)
+ && TREE_CODE (selem) == INTEGER_CST
+ && (lhs = gimple_call_lhs (stmt)) != NULL_TREE)
{
- tree lhs = gimple_call_lhs (stmt);
tree size = fold_build2 (MULT_EXPR, TREE_TYPE (nelem),
nelem, selem);
ao_ref_init_from_ptr_and_size (write, lhs, size);