[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

--- Comment #4 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Steve Kargl from comment #3)
> I would need to dig out an older standard.  IIRC, in the old days an
> allocatable entity could be undefined, unallocated, or allocated.
> I think, but need to check, F18 decided such an entity could only be
> unallocated or allocated, and removed the undefine-ness possibility.
> The statement on page 149 of Fortran 2023 that may be relevant is
> 
>     At the beginning of execution of a program, allocatable variables
>     are unallocated.
> 
From the 04-007 document (that's f2003 I think):
    The allocation status of an allocatable entity is one of the following at
    any time during the execution of a program:
     (1) The status of an allocatable variable becomes allocated if (...). An
         allocatable variable with this status may be referenced, defined, or
         deallocated; (...)
     (2) An allocatable variable has a status of unallocated if (...). An
         allocatable variable with this status shall not be referenced or
         defined. It shall not be supplied as an actual argument corresponding
         to a nonallocatable dummy argument, except to certain intrinsic
inquiry
         functions. (...)

    At the beginning of execution of a program, allocatable variables are
    unallocated.

I think this wording is only marginally different from f2023.  The main
principles are the same.
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.