fortran: Use CLASS_DATA from gfortran.h

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.
This commit is contained in:
Bernhard Reutner-Fischer 2023-05-18 18:04:10 +02:00
parent cddb6dd666
commit 05b7cc7daa
3 changed files with 16 additions and 16 deletions

View 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;

View 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;

View 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)
{