https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104908
anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|gfortran 11/trunk |[11/12 Regression] |regression: incorrect |incorrect Fortran |Fortran out-of-bound |out-of-bound runtime error. |runtime error. | Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2022-03-15 Priority|P3 |P4 --- Comment #1 from anlauf at gcc dot gnu.org --- Likely caused by the fix for PR95331 (r11-1235). Class-related. Applying diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index cfb6eac11c7..3a14600101f 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -3864,8 +3864,8 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_expr *expr, } decl = se->expr; - if (IS_CLASS_ARRAY (sym) && sym->attr.dummy && ar->as->type != AS_DEFERRED) - decl = sym->backend_decl; + // if (IS_CLASS_ARRAY (sym) && sym->attr.dummy && ar->as->type != AS_DEFERRED) + // decl = sym->backend_decl; cst_offset = offset = gfc_index_zero_node; add_to_offset (&cst_offset, &offset, gfc_conv_array_offset (decl)); apparently "fixes" the wrong bounds check.