https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126517
Mikael Morin <mikael at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #2 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Steve Kargl from comment #1)
> I think the code is invalid.
>
> F2023: 15.6.2.2 Function subprogram:
> ...
> If the function result is not a pointer, its value shall be defined
> by the function. If the function result is a pointer, on return the
> pointer association status of the function result shall not be undefined.
>
> The first sentence above indicates that the function
> result needs be defined, and only way that can happen is if
> the function result variable is allocated.
OK, makes sense. So allocatable functions can't return a nullified descriptor,
whereas pointer functions can. I tested a similar example with pointers, and
that one works as expected. So I'm closing this. Thanks for the feedback.