Le 12/10/2026 à 17:20, Paul Richard Thomas a écrit :
Hello Mikael,

Thanks for taking a look at this. I have incorporated your suggestion
in the attached, revamped patch.

Slightly more substantial modification has resulted for a review by
Claude, which pointed out that co-dimension variables were still
giving double free signals and already deallocated variables,
deallocated again with stat =, were segaulting. These defects are
fixed.

The patch passes regression testing on FC44/x86_64. OK for mainline?

Cheers

Paul

Hello Paul; just one nit...
diff --git a/gcc/fortran/trans-stmt.cc b/gcc/fortran/trans-stmt.cc
index 19817180acd..6c3e9cdbb59 100644
--- a/gcc/fortran/trans-stmt.cc
+++ b/gcc/fortran/trans-stmt.cc
@@ -7968,6 +7968,21 @@ gfc_trans_deallocate (gfc_code *code)
                                         se.expr, pdt_rank);
        }
+ if (tmp)
+       {
+         tree null_cond, zero;
+         null_cond = se.expr;
+         if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (se.expr)))
+           null_cond = gfc_conv_descriptor_data_get (null_cond);
+         zero = build_int_cst (TREE_TYPE (null_cond), 0);
+         null_cond = fold_build2_loc (input_location, NE_EXPR,
+                                      logical_type_node,
+                                      null_cond, zero);
+         tmp = build3_loc (input_location, COND_EXPR, void_type_node,
+                           null_cond, tmp,
+         build_empty_stmt (input_location));
Indentation is wrong here; OK with that fixed.

+       }
+
       if (tmp)
        gfc_add_expr_to_block (&se.pre, tmp);

Reply via email to