https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98883
--- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Fri, Jan 29, 2021 at 06:55:16PM +0000, kargl at gcc dot gnu.org wrote:
>
> --- Comment #2 from kargl at gcc dot gnu.org ---
> This bug report should be closed.
>
> Please read the description of option that you are using.
>
> -freal-init=nan applies to **** LOCAL ***** variables.
> 'bar' is not local to program test, and clearly the option
> does not affect variables made available via USE association.
>
I'll also point out that 'bar' is local module
to the module, but as it is unused gfortran
won't initialize it via -finit-real=nan. If you
actual use it, it gets initialized.
module foo
implicit none
real :: bar
contains
subroutine bah
real boo
boo = bar ! <-- Sufficient to get bar = NaN
print *, boo
end subroutine bah
end module foo
program test
use foo
implicit none
real w
print *, w
w = bar
print *, w
end program test