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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
OK, so we're having memory_access_type == VMAT_GATHER_SCATTER, gs_info.ifn !=
IFN_LAST but STMT_VINFO_GATHER_SCATTER_P is false.  It looks like vec_offset is
set elsewhere in that case.  Likely here:

  else if (memory_access_type == VMAT_GATHER_SCATTER)
    {
      aggr_type = elem_type;
      vect_get_strided_load_store_ops (stmt_info, loop_vinfo, &gs_info,
                                       &bump, &vec_offset);
    }

so the fix is to re-instante the guard, doing

diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index ab402b57fb4..cc6c091e41e 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -9492,7 +9492,8 @@ vectorizable_load (vec_info *vinfo,
                    if (memory_access_type == VMAT_GATHER_SCATTER
                        && gs_info.ifn != IFN_LAST)
                      {
-                       vec_offset = vec_offsets[j];
+                       if (STMT_VINFO_GATHER_SCATTER_P (stmt_info))
+                         vec_offset = vec_offsets[j];
                        tree zero = build_zero_cst (vectype);
                        tree scale = size_int (gs_info.scale);
                        gcall *call;

will push this as obvious.

Reply via email to