https://gcc.gnu.org/g:f6bd7f7ed8049f50c5f329d83ff094e7b2a24990

commit f6bd7f7ed8049f50c5f329d83ff094e7b2a24990
Author: Mikael Morin <[email protected]>
Date:   Sun Sep 20 15:25:12 2026 +0200

    Essai correction régression class_allocate_22

Diff:
---
 gcc/fortran/trans-stmt.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/fortran/trans-stmt.cc b/gcc/fortran/trans-stmt.cc
index 2a87176ffa9f..8985d3ae30ba 100644
--- a/gcc/fortran/trans-stmt.cc
+++ b/gcc/fortran/trans-stmt.cc
@@ -6796,7 +6796,10 @@ gfc_trans_allocate (gfc_code * code, gfc_omp_namelist 
*omp_allocate)
                                     code->expr3->ts,
                                     false, true,
                                     false, false);
-         temp_obj_created = temp_var_needed = !VAR_P (se.expr);
+         temp_var_needed = !(VAR_P (se.expr)
+                             || (TREE_CODE (se.expr) == ADDR_EXPR
+                                 && VAR_P (TREE_OPERAND (se.expr, 0))));
+         temp_obj_created = temp_var_needed;
        }
       gfc_add_block_to_block (&block, &se.pre);
       if (code->expr3->must_finalize)

Reply via email to