https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113471
anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC|anlauf at gmx dot de | Assignee|unassigned at gcc dot gnu.org |anlauf at gcc dot gnu.org --- Comment #2 from anlauf at gcc dot gnu.org --- The following patch fixes the reduced testcase for me, as well as the full testcase in comment#0: diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index 26e7adaa03f..3e1a400fa33 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -3600,7 +3600,9 @@ array_bound_check_elemental (gfc_se * se, gfc_ss * ss, gfc_expr * expr) continue; } - if (ref->type == REF_ARRAY && ref->u.ar.dimen > 0) + if (ref->type == REF_ARRAY + && ref->u.ar.type == AR_SECTION + && ref->u.ar.dimen > 0) { ar = &ref->u.ar; for (dim = 0; dim < ar->dimen; dim++) Can you give it a spin?