This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Bug?
- From: "Takayuki Tanigawa" <tanigawa at geo dot titech dot ac dot jp>
- To: <fortran at gcc dot gnu dot org>
- Cc: "Takayuki Tanigawa" <tanigawa at geo dot titech dot ac dot jp>
- Date: Thu, 1 Jun 2006 21:49:20 +0900
- Subject: Bug?
Using "GNU Fortran 95 (GCC) 4.2.0 20060420 (experimental)"
Following program should return 4.0, but does return 9.0.
And I think the compiler should give a warning or an error
at substituting 3 into the variable "a".
The variable "a" is implicitly treated as an "intent(inout)" argument
even though "implicit none" is declered.
The same program compiled by the intel compiler gives 4.0.
------------------------
program test
implicit none
real(8) :: a
a = 2.0d0
print*, func(a)
contains
real(8) function func(x)
real(8), intent(in) :: x
a = 3.0d0
func = x**2
end function func
end program test
------------------------