https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98454

--- Comment #4 from kargl at gcc dot gnu.org ---
(In reply to anlauf from comment #2)
> I think there already exists at least one PR with issues with initializers.
> 
> A reduced testcase shows that default initialization works for intent(out),
> whereas you get random junk for function results.

(code elide)

> If you need a workaround, uncomment the indicated line.

The code is invalid Fortran.  gfortran can do anything.
Your work around is invalid.  gfortran can do anything.

>From Fortran 2018:

"If the function result is not a pointer, its value shall be
defined by the function."

and
"A derived-type scalar object is defined if and only if all
of its nonpointer components are defined."


Should be closed as invalid as the original code contains a number
of issues caused by invalid code.

Reply via email to