vect_build_slp_instance always releases the scalar stmts vector, so make sure
to mark it as released.

Bootstrapped and tested on x86_64-unknown-linux-gnu.  This should fix
the observed double-free?

Thanks,
Richard.

        * tree-vect-slp.cc (vect_analyze_slp): Mark stmts in BB roots
        as released after vect_build_slp_instance.
---
 gcc/tree-vect-slp.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index e02b3379bb4..1ea2b066bfa 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -5564,10 +5564,10 @@ vect_analyze_slp (vec_info *vinfo, unsigned 
max_tree_size,
                                       bb_vinfo->roots[i].remain,
                                       max_tree_size, &limit, bst_map, false))
            {
-             bb_vinfo->roots[i].stmts = vNULL;
              bb_vinfo->roots[i].roots = vNULL;
              bb_vinfo->roots[i].remain = vNULL;
            }
+         bb_vinfo->roots[i].stmts = vNULL;
        }
     }
 
-- 
2.51.0

Reply via email to