]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
fortran: Use CLASS_DATA from gfortran.h
authorBernhard Reutner-Fischer <aldot@gcc.gnu.org>
Thu, 18 May 2023 16:04:10 +0000 (18:04 +0200)
committerBernhard Reutner-Fischer <aldot@gcc.gnu.org>
Fri, 19 May 2023 18:45:39 +0000 (20:45 +0200)
gcc/fortran/ChangeLog:

* expr.cc (gfc_get_corank): Use CLASS_DATA from gfortran.h.
* resolve.cc (resolve_component): Same.
(resolve_fl_derived0): Same.
* simplify.cc (gfc_simplify_extends_type_of): Same.
(simplify_cobound): Same.

gcc/fortran/expr.cc
gcc/fortran/resolve.cc
gcc/fortran/simplify.cc

index 073fb56fae07da451ec46c9296979b459307f56e..d5cfbe0cc55440f04f1c227d7b5bbf0f044c640e 100644 (file)
@@ -5847,9 +5847,9 @@ gfc_get_corank (gfc_expr *e)
   if (!gfc_is_coarray (e))
     return 0;
 
-  if (e->ts.type == BT_CLASS && e->ts.u.derived->components)
-    corank = e->ts.u.derived->components->as
-            ? e->ts.u.derived->components->as->corank : 0;
+  if (e->ts.type == BT_CLASS && CLASS_DATA (e))
+    corank = CLASS_DATA (e)->as
+            ? CLASS_DATA (e)->as->corank : 0;
   else
     corank = e->symtree->n.sym->as ? e->symtree->n.sym->as->corank : 0;
 
index c3cb3528c3adcef32af751d92fd100c6e21c53d3..5f1fc9633ca57b8311749c0078d48f4ad03a9ef8 100644 (file)
@@ -15187,7 +15187,7 @@ resolve_component (gfc_component *c, gfc_symbol *sym)
   /* Check type-spec if this is not the parent-type component.  */
   if (((sym->attr.is_class
         && (!sym->components->ts.u.derived->attr.extension
-            || c != sym->components->ts.u.derived->components))
+           || c != CLASS_DATA (sym->components)))
        || (!sym->attr.is_class
            && (!sym->attr.extension || c != sym->components)))
       && !sym->attr.vtype
@@ -15200,7 +15200,7 @@ resolve_component (gfc_component *c, gfc_symbol *sym)
      component.  */
   if (super_type
       && ((sym->attr.is_class
-           && c == sym->components->ts.u.derived->components)
+          && c == CLASS_DATA (sym->components))
           || (!sym->attr.is_class && c == sym->components))
       && strcmp (super_type->name, c->name) == 0)
     c->attr.access = super_type->attr.access;
@@ -15446,7 +15446,7 @@ resolve_fl_derived0 (gfc_symbol *sym)
       return false;
     }
 
-  c = (sym->attr.is_class) ? sym->components->ts.u.derived->components
+  c = (sym->attr.is_class) ? CLASS_DATA (sym->components)
                           : sym->components;
 
   success = true;
index a7b4784d73aaf247b25ed8f65244c5c9355af144..6ba2040e61cc38ba6d48a3e6e973c99cd7d72424 100644 (file)
@@ -3116,28 +3116,28 @@ gfc_simplify_extends_type_of (gfc_expr *a, gfc_expr *mold)
   /* Return .false. if the dynamic type can never be an extension.  */
   if ((a->ts.type == BT_CLASS && mold->ts.type == BT_CLASS
        && !gfc_type_is_extension_of
-                       (mold->ts.u.derived->components->ts.u.derived,
-                        a->ts.u.derived->components->ts.u.derived)
+                       (CLASS_DATA (mold)->ts.u.derived,
+                        CLASS_DATA (a)->ts.u.derived)
        && !gfc_type_is_extension_of
-                       (a->ts.u.derived->components->ts.u.derived,
-                        mold->ts.u.derived->components->ts.u.derived))
+                       (CLASS_DATA (a)->ts.u.derived,
+                        CLASS_DATA (mold)->ts.u.derived))
       || (a->ts.type == BT_DERIVED && mold->ts.type == BT_CLASS
          && !gfc_type_is_extension_of
-                       (mold->ts.u.derived->components->ts.u.derived,
+                       (CLASS_DATA (mold)->ts.u.derived,
                         a->ts.u.derived))
       || (a->ts.type == BT_CLASS && mold->ts.type == BT_DERIVED
          && !gfc_type_is_extension_of
                        (mold->ts.u.derived,
-                        a->ts.u.derived->components->ts.u.derived)
+                        CLASS_DATA (a)->ts.u.derived)
          && !gfc_type_is_extension_of
-                       (a->ts.u.derived->components->ts.u.derived,
+                       (CLASS_DATA (a)->ts.u.derived,
                         mold->ts.u.derived)))
     return gfc_get_logical_expr (gfc_default_logical_kind, &a->where, false);
 
   /* Return .true. if the dynamic type is guaranteed to be an extension.  */
   if (a->ts.type == BT_CLASS && mold->ts.type == BT_DERIVED
       && gfc_type_is_extension_of (mold->ts.u.derived,
-                                  a->ts.u.derived->components->ts.u.derived))
+                                  CLASS_DATA (a)->ts.u.derived))
     return gfc_get_logical_expr (gfc_default_logical_kind, &a->where, true);
 
   return NULL;
@@ -4344,8 +4344,8 @@ simplify_cobound (gfc_expr *array, gfc_expr *dim, gfc_expr *kind, int upper)
     return NULL;
 
   /* Follow any component references.  */
-  as = (array->ts.type == BT_CLASS && array->ts.u.derived->components)
-       ? array->ts.u.derived->components->as
+  as = (array->ts.type == BT_CLASS && CLASS_DATA (array))
+       ? CLASS_DATA (array)->as
        : array->symtree->n.sym->as;
   for (ref = array->ref; ref; ref = ref->next)
     {