https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72832
--- Comment #3 from vehre at gcc dot gnu.org --- This patch fragment fixes the first issue: diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index 5884e7a..8e5428a 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -5485,7 +5485,8 @@ gfc_trans_allocate (gfc_code * code) desc = tmp; tmp = gfc_class_data_get (tmp); } - e3_is = E3_DESC; + if (code->ext.alloc.arr_spec_from_expr3) + e3_is = E3_DESC; } else desc = !is_coarray ? se.expr