How to make gfortran give a warning for reading variables declared as intent(out) without initializing it first?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

The following code shows that even "b" is declared as "real(dp),
intent(out)" in bar. It still can get the value 2 defined in the main
program.

I'd think that the gfortran should have warned the user that "b" is
used without being first set in "bar". Is this feature available in
gfortran? Thanks.

$ cat main.f90
program main
  integer, parameter :: dp=kind(1.0d0)
  real(dp) a, b
  a = 1
  b = 2
  call bar(a, b)
  print *, a, b
end program

subroutine bar (a, b)
  integer, parameter :: dp=kind(1.0d0)
  real(dp), intent(in) :: a
  real(dp), intent(out) :: b
  print *, b
  b = a
end subroutine

-- 
Regards,
Peng



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux