https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67311

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #2)
> Ugh, Fortran really allows this mess (effectively self-referential types)?

It has to - otherwise how to you implement linked lists?

However, I don't know what this is supposed to do in the context of OpenMP. For
coarrays, pointer components are ignored in the context of copying them to
other processes ("images") only directly accessing their values is permitted.
If OpenMP works likewise, I'd expect that only the nonpointer components are
created as private object and that the status of the pointer components is
undefined.

> But if the type has allocatable components, is there anything that would
> prevent the need for endless recursion when actually generating code to
> expand it?

> Or is here only POINTER allowed and not ALLOCATABLE?
>   TYPE myType
>     TYPE(myType), DIMENSION(:), ALLOCATABLE :: x
>   END TYPE myType

Fortran 2008 allows allocatable components, which gfortran does not support
(unless I missed an addition in the last few months). However, that requires
explicit action, i.e. you allocate  the component. Then you can access it and
allocate its component etc.
That chain is finite and the innermost one has the allocation status
unallocated (internally, it points to NULL). And as no loops are possible and
no alising within the type, one can simply walk it.

Reply via email to