[Bug fortran/126517] Assigning an unallocated allocatable function result array to an allocatable causes segmentation fault

"mikael at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.