I am testing a procedure for which I wrote a subroutine in which I declared a parameter a
Module f1
implicit none
contains
Subroutine function1 (var)
implicit none
integer, intent(in) :: var
integer, parameter :: a=3.5
print*, "initial var is ", var
end Subroutine function1
end module f1
Now, I called this subroutine in my main program in the following way
program f2
use f1, only: function1
implicit none
integer :: y
integer :: z,x
integer :: a
y=2
x=1
CALL function1 (x)
z=x+y+a
print*, "My sum is ", z
end program f2
The value of my parameter a
gets changed. When I compiled and linked my program, I got the following output
initial var is 1
My sum is 543297931
When I printed the value of a
, I got
My parameter is 543297928
I am unable to understand why my value gets changed. I also checked about some common procedures which cause such issues but I did not get any hint.