This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

------------------------



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]