Is there a way to check if anti-aliasing is occurring in the Fortran routine, or at least notify the compiler of a warning issue?
Consider this (rather simplified) example:
module alias
contains
subroutine myAdd(a, b, c)
integer,intent(in) :: a, b
integer,intent(inout) :: c
c = 0
c = a + b
end subroutine
end module
program test
use alias
integer :: a, b
a = 1 ; b = 2
call myAdd(a, b, b)
print *, b, 'is not 3'
end program
Here in the subroutine, the result is zero. If the same variable is specified as input and output, the result is (obviously) incorrect. Is there a way to capture this type of alias at runtime or at compile time?
source
share