https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99138
--- Comment #3 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #2)
> Confirmed – with 'class(*), allocatable :: f(:)' it should be valid (with
> prior assignment).
>
> The problem is in gfc_match_rvalue:
>
> 3737 if (sym->ts.type == BT_CLASS && sym->attr.class_ok
> 3738 && CLASS_DATA (sym)->as)
>
> without submodules, we have:
> sym->ts.u.derived->components->as
> which is working (and either NULL in the original example or != NULL with my
> modification).
>
> However, with submodules,
> sym->ts.u.derived->components
> is NULL, i.e. 'sym->ts.u.derived' (name = "STAR") does not have any
> scomponents, but it should have two, _data and _vptr!
Hi Tobias,
Is the problem not that the parser is not picking up the incorrectly placed
print statement? It should never be passed to the matcher because it is in the
contains context.
It also should said that it has everything to do with module procedures and
nothing to do with submodules. This has the same error sequence:
module m
interface
module function f(x)
integer, intent(in) :: x
class(*), allocatable :: f
end
end interface
contains
module function f(x)
integer, intent(in) :: x
class(*), allocatable :: f
end function
print *, f(3)
end
I suspect that the end function is not popping the level.
Cheers
Paul