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

--- Comment #2 from janus at gcc dot gnu.org ---
(In reply to Richard Biener from comment #1)
> (does intent(out) mean it comes in uninitialized?)

Yes. To quote the Fortran 2008 standard (from section 5.3.10):

"The INTENT (OUT) attribute for a nonpointer dummy argument specifies that the
dummy argument becomes undefined on invocation of the procedure, except for any
subcomponents that are default-initialized (4.5.4.6)."


> So - is 'o' uninitialized in
> 
> subroutine test(o)
>  integer, intent(out) :: o
>  print *, o
> end subroutine
> 
> ?

Absolutely (see above). Even if the actual argument has been initialized before
invocation of the subroutine, the Fortran standard requires the compiler to
treat 'o' as being uninitialized on entering the subroutine.


> (we don't warn but I also think we have no way to
> annotate sth as uninitalized that is passed by reference).

:(

Reply via email to