https://gcc.gnu.org/g:187cc54f13f8809a795bfc011b52eb5d4fa51367

commit 187cc54f13f8809a795bfc011b52eb5d4fa51367
Author: Mikael Morin <[email protected]>
Date:   Thu Oct 15 13:57:56 2026 +0200

    Correction partielle optional_absent_1

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 3f4a62a2f70d..7ec742b15c51 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -5488,7 +5488,15 @@ gfc_conv_subref_array_arg (gfc_se *se, gfc_expr * expr, 
int g77,
   bool pass_optional;
   bool readonly;
 
-  pass_optional = fsym && fsym->attr.optional && sym && sym->attr.optional;
+  pass_optional = fsym && fsym->attr.optional
+                 && sym
+                 && (sym->attr.optional
+                     || (sym->ts.type == BT_CLASS
+                         && sym->ts.u.derived->attr.is_class
+                         && (CLASS_DATA (sym)->attr.allocatable
+                             || CLASS_DATA (sym)->attr.class_pointer))
+                     || sym->attr.allocatable
+                     || sym->attr.pointer) ;
 
   if (pass_optional || check_contiguous)
     {

Reply via email to