Some compilers (such as Pathscale, cf. http://www.pathscale.com/docs/UserGuide.pdf, section 3.10.2) have an option to check at run-time for aliasing among Fortran dummy arguments.
(This option "has several friends, and when a customer sees a wrong answer, the first thing we do (or the customer does, if they've read the docs) is compile with all of these options, which will quickly lead them to the type of bug.", Greg Lindahl in c.l.f) The following examples are invalid (and ill-defined too). Richard Main writes in c.l.f (link below): "The code is nonstandard. Some people overstate the restriction in question by saying that aliasing is disallowed. Aliasing is allowed, but there are restrictions on it. One of those restrictions is that you may not modify the value of either of the aliased variables. Thus there is no correct answer and the compilers are free to do anything they want with it. This is not an error that compilers are required to catch." Example 1 (based on the example in the Pathscale manual): program bar implicit none real c(100) c = 5 call foo(c,c) print *,c(1:5) contains subroutine foo(a,b) integer i real a(100), b(100) do i = 2, 100 a(i) = b(i) - b(i-1) enddo end subroutine foo end program bar Example 2, based on the first post in http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/2b4df0a44e704b7f/70c44bc5ea8cafb0 program test implicit none integer, dimension(3,3) :: n call sub(n(1,:),n(1,:)) write(6,*) n(1,:) contains subroutine sub(a,b) implicit none integer, dimension(3), intent(inout) :: a integer, dimension(3), intent(inout) :: b a=(/4,5,6/) b=(/-4,-5,-6/) end subroutine end program test -- Summary: Option for run-time checking for aliasing amoung dummy arguments Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: diagnostic Severity: enhancement Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30373