From: Richard Biener Date: Thu, 23 Oct 2025 08:54:48 +0000 (+0200) Subject: Fix possible segfault in load/store-lane analysis X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ceda79ca5fe1a1a296624a98de8fd04958fbe55;p=thirdparty%2Fgcc.git 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 --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 9320bf8e878..bc01e12f05b 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);