https://gcc.gnu.org/g:259b666d9af1efabd13afe1ca9c44b292949043d
commit 259b666d9af1efabd13afe1ca9c44b292949043d Author: Mikael Morin <[email protected]> Date: Sun Sep 20 16:12:35 2026 +0200 Sauvegarde modifs Diff: --- gcc/fortran/trans-stmt.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gcc/fortran/trans-stmt.cc b/gcc/fortran/trans-stmt.cc index 678142359533..739a62a798e2 100644 --- a/gcc/fortran/trans-stmt.cc +++ b/gcc/fortran/trans-stmt.cc @@ -6859,12 +6859,14 @@ gfc_trans_allocate (gfc_code * code, gfc_omp_namelist *omp_allocate) : TREE_OPERAND (TREE_OPERAND (se.expr, 0), 0); /* We need a regular (non-UID) symbol here, therefore give a prefix. */ - var = gfc_create_var (TREE_TYPE (tmp), "source"); - gfc_add_modify_loc (input_location, &block, var, tmp); if (source_class == NULL_TREE) source_class = desc; - - expr3 = var; + if (!VAR_P (tmp)) + { + var = gfc_create_var (TREE_TYPE (tmp), "source"); + gfc_add_modify_loc (input_location, &block, var, tmp); + expr3 = var; + } if (se.string_length) /* Evaluate it assuming that it also is complicated like expr3. */ expr3_len = gfc_evaluate_now (se.string_length, &block);
