https://gcc.gnu.org/g:7470b2f120badc9d947e51ad193f7de83880be98
commit 7470b2f120badc9d947e51ad193f7de83880be98 Author: Mikael Morin <mik...@gcc.gnu.org> Date: Wed Jun 4 16:12:40 2025 +0200 Correction régression pr68864 Diff: --- gcc/fortran/trans-stmt.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/trans-stmt.cc b/gcc/fortran/trans-stmt.cc index 02d3e9e5a397..6949e00a3460 100644 --- a/gcc/fortran/trans-stmt.cc +++ b/gcc/fortran/trans-stmt.cc @@ -7838,7 +7838,12 @@ gfc_trans_deallocate (gfc_code *code) if (al->expr->ts.type == BT_CLASS) { - gfc_reset_vptr (&se.pre, al->expr); + if (is_subref_array (al->expr)) + /* Finalisation code can create bogus + array subreferences, ignore those. */ + ; + else + gfc_reset_vptr (&se.pre, al->expr); if (UNLIMITED_POLY (al->expr) || (al->expr->ts.type == BT_DERIVED && al->expr->ts.u.derived->attr.unlimited_polymorphic))