]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fortran: Fix wasting memory in coarray single mode.
authorAndre Vehreschild <vehre@gcc.gnu.org>
Wed, 25 Jun 2025 10:27:04 +0000 (12:27 +0200)
committerAndre Vehreschild <vehre@gcc.gnu.org>
Thu, 26 Jun 2025 08:44:42 +0000 (10:44 +0200)
gcc/fortran/ChangeLog:

* resolve.cc (resolve_fl_derived0): Do not create the token
component when not in coarray lib mode.
* trans-types.cc: Do not access the token when not in coarray
lib mode.

gcc/fortran/resolve.cc
gcc/fortran/trans-types.cc

index 7089e4f171d11432522695e26d34d155b10565df..58f7aee29c357dc51b31e1da1c2ecbc6292d0f37 100644 (file)
@@ -16841,8 +16841,8 @@ resolve_fl_derived0 (gfc_symbol *sym)
     return false;
 
   /* Now add the caf token field, where needed.  */
-  if (flag_coarray != GFC_FCOARRAY_NONE
-      && !sym->attr.is_class && !sym->attr.vtype)
+  if (flag_coarray == GFC_FCOARRAY_LIB && !sym->attr.is_class
+      && !sym->attr.vtype)
     {
       for (c = sym->components; c; c = c->next)
        if (!c->attr.dimension && !c->attr.codimension
index e15b1bb89f01ff88fb679f5dbd4667fdd00990d9..1754d9821532b288ea3406966702f0ac5ae444bb 100644 (file)
@@ -3187,7 +3187,7 @@ copy_derived_types:
     for (c = derived->components; c; c = c->next)
       {
        /* Do not add a caf_token field for class container components.  */
-       if ((codimen || coarray_flag) && !c->attr.dimension
+       if (codimen && coarray_flag && !c->attr.dimension
            && !c->attr.codimension && (c->attr.allocatable || c->attr.pointer)
            && !derived->attr.is_class)
          {