[Bug fortran/125761] Wrong code: array section of an unlimited-polymorphic CHARACTER array
jvdelisle2 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Jun 22 23:08:27 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125761
--- Comment #5 from Jerry DeLisle <jvdelisle2 at gmail dot com> ---
(In reply to Mikael Morin from comment #4)
---snip---
>
> We should try to have the GFC_CLASS_TYPE_P set on the type directly,
> otherwise we'll have to duplicate this condition everywhere the flag is used.
>
> gfc_typenode_for_spec has:
>
> case BT_DERIVED:
> case BT_CLASS:
> basetype = gfc_get_derived_type (spec->u.derived, codim);
>
> if (spec->type == BT_CLASS)
> GFC_CLASS_TYPE_P (basetype) = 1;
>
> The generation of class descriptors as additional symbols has its downsides,
> but here it could help us as it makes polymorphic derived types (i.e.
> class(...)) use a separate symbol different from regular derived types. So
> gfc_get_derived_type in the snippet above could return a type with the
> GFC_CLASS_TYPE_P flag already set. I think it would be set basically when
> the derived type symbol has the is_class attribute.
Good point, I will adjust and see what happens.
More information about the Gcc-bugs
mailing list