https://gcc.gnu.org/g:0b53c106c5733d39675263672ec966f266805ae7
commit 0b53c106c5733d39675263672ec966f266805ae7 Author: Mikael Morin <[email protected]> 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 429ad149b681..6f018bcc8d7a 100644 --- a/gcc/fortran/trans-stmt.cc +++ b/gcc/fortran/trans-stmt.cc @@ -8009,7 +8009,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))
