[Bug fortran/109066] Segfault when using defined assignment
kargl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Mar 9 15:33:37 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109066
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #3 from kargl at gcc dot gnu.org ---
(In reply to Paul Thomas from comment #2)
> Hi Andrew,
>
> Thanks for the report. However, IMHO the code is invalid since the result of
> hdf5Constructor is not defined.
>
> function hdf5Constructor() result(self)
> implicit none
> type(hdf5Object) :: self
> self = hdf5Object (resourceManager())
> return
> end function hdf5Constructor
>
> works a treat.
>
> If there is a requirement in the standard that a function result such as
> this be initialised, I am unable to find it in the F2018 standard.
>
> Paul
F2018, page 319.
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.
More information about the Gcc-bugs
mailing list