do we expect compiler to catch this?
Uttam Pawar
uttamp@us.ibm.com
Thu Nov 17 19:10:00 GMT 2005
Hi,
cat test.f90
subroutine func(r)
real, intent(out) :: r
r = 2.0
end subroutine func
program test
func(1.0)
end
This program gets compiled fine, but gets segfault at run time, do we
expect the compiler to catch this kind of error.
This scenario will be true for many intrinsics (one of them is
cpu_time). So if we decide to ignore it, as a user error then we could
look over many cases which contains something similar.
This can be one of the constraints test case wherever applied (type of
argument might be different but the goal is still the same).
If the variable in subroutine is intent(in) type, then compiler handles
it fine with an error, "Error: Can't assign to INTENT(IN) variable 'r'
at (1)".
Thanks in advance.
- Uttam
More information about the Fortran
mailing list