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

commit r15-7803-gef605e106c6075bfe2a5625add7185a9a3f722b1
Author: Andre Vehreschild <ve...@gcc.gnu.org>
Date:   Mon Mar 3 10:41:05 2025 +0100

    Fortran: Reduce code complexity [PR77872]
    
            PR fortran/77872
    
    gcc/fortran/ChangeLog:
    
            * trans-expr.cc (gfc_conv_procedure_call): Use attr instead of
            doing type check and branching for BT_CLASS.

Diff:
---
 gcc/fortran/trans-expr.cc | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index e619013f261e..7c0b17428cdd 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -8216,23 +8216,15 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
       /* For descriptorless coarrays and assumed-shape coarray dummies, we
         pass the token and the offset as additional arguments.  */
       if (fsym && e == NULL && flag_coarray == GFC_FCOARRAY_LIB
-         && ((fsym->ts.type != BT_CLASS && fsym->attr.codimension
-              && !fsym->attr.allocatable)
-             || (fsym->ts.type == BT_CLASS
-                 && CLASS_DATA (fsym)->attr.codimension
-                 && !CLASS_DATA (fsym)->attr.allocatable)))
+         && attr->codimension && !attr->allocatable)
        {
          /* Token and offset.  */
          vec_safe_push (stringargs, null_pointer_node);
          vec_safe_push (stringargs, build_int_cst (gfc_array_index_type, 0));
          gcc_assert (fsym->attr.optional);
        }
-      else if (fsym && flag_coarray == GFC_FCOARRAY_LIB
-              && ((fsym->ts.type != BT_CLASS && fsym->attr.codimension
-                   && !fsym->attr.allocatable)
-                  || (fsym->ts.type == BT_CLASS
-                      && CLASS_DATA (fsym)->attr.codimension
-                      && !CLASS_DATA (fsym)->attr.allocatable)))
+      else if (fsym && flag_coarray == GFC_FCOARRAY_LIB && attr->codimension
+              && !attr->allocatable)
        {
          tree caf_decl, caf_type, caf_desc = NULL_TREE;
          tree offset, tmp2;

Reply via email to