https://gcc.gnu.org/g:1ceda79ca5fe1a1a296624a98de8fd04958fbe55

commit r16-4571-g1ceda79ca5fe1a1a296624a98de8fd04958fbe55
Author: Richard Biener <[email protected]>
Date:   Thu Oct 23 10:54:48 2025 +0200

    Fix possible segfault in load/store-lane analysis
    
    The following fixes a segfault that appeared with a patch applying
    additional permutes to a reduction SLP instance root.
    
            * tree-vect-loop.cc (vect_analyze_loop_2): Deal with NULL
            element in SLP_TREE_SCALAR_STMTS.

Diff:
---
 gcc/tree-vect-loop.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 9320bf8e878d..bc01e12f05bc 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -2598,7 +2598,7 @@ again:
 
       stmt_vec_info vinfo;
       vinfo = SLP_TREE_SCALAR_STMTS (SLP_INSTANCE_TREE (instance))[0];
-      if (! STMT_VINFO_GROUPED_ACCESS (vinfo))
+      if (!vinfo || !STMT_VINFO_GROUPED_ACCESS (vinfo))
        continue;
       vinfo = DR_GROUP_FIRST_ELEMENT (vinfo);
       unsigned int size = DR_GROUP_SIZE (vinfo);

Reply via email to