https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97896
--- Comment #3 from anlauf at gcc dot gnu.org ---
(In reply to anlauf from comment #2)
> Reverting the following snippet from my fix attempt for pr91651:
That snippet is necessary for the scalarizer during simplification.
The original ICE is coming from the assert in trans-expr.c:
11155 else
11156 {
11157 gcc_assert (lse.ss == gfc_ss_terminator
11158 && rse.ss == gfc_ss_terminator);
Printing lse.ss and rse.ss for
b = index ('xyxyz','yx', back=a)
b = index ('xyxyz','yx', back=a, kind=4)
one sees that the first case without kind is fine, while the second case has
(gdb) p *rse.ss
$30 = {info = 0x288c1c0, dimen = 0, dim = {0 <repeats 15 times>}, loop_chain =
0x2814270,
next = 0x268eb80 <gfc_ss_terminator_var>, parent = 0x0, nested_ss = 0x0,
loop = 0x7fffffffcd90, is_alloc_lhs = 0, no_bounds_check = 0}
so something is screwing up the scalarization.