https://gcc.gnu.org/g:03ccc2236958ff79257c9d9185c2821ef239a7f8

commit 03ccc2236958ff79257c9d9185c2821ef239a7f8
Author: Mikael Morin <[email protected]>
Date:   Thu Oct 15 13:07:41 2026 +0200

    Correction partielle optional_absent_12

Diff:
---
 gcc/fortran/trans-expr.cc | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index 248b4c65a3e6..92fb7779d05a 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -5922,8 +5922,16 @@ class_array_fcn:
                  || sym->attr.allocatable
                  || sym->attr.pointer))
            {
+             tree ptr = gfc_get_symbol_decl (sym);
+             if (sym->ts.type == BT_CLASS)
+               ptr = gfc_class_data_get (ptr);
+             if (POINTER_TYPE_P (ptr)
+                 && GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (TREE_TYPE (ptr))))
+               ptr = build_fold_indirect_ref_loc (input_location, ptr);
+             if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (ptr)))
+               ptr = gfc_conv_descriptor_data_get (ptr);
              tree non_null = fold_build2_loc (input_location, NE_EXPR,
-                                              boolean_type_node, pointer,
+                                              boolean_type_node, ptr,
                                               build_zero_cst (type));
              tmp = fold_build2_loc (input_location, TRUTH_ANDIF_EXPR,
                                     boolean_type_node, tmp, non_null);

Reply via email to