https://gcc.gnu.org/g:30c313beeeb2aeedb3a32747485cac066da0bf61
commit 30c313beeeb2aeedb3a32747485cac066da0bf61 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 9a92a91a5e43..63ced14d77e3 100644 --- a/gcc/fortran/trans-stmt.cc +++ b/gcc/fortran/trans-stmt.cc @@ -8001,7 +8001,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))