https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68765
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |kargl at gcc dot gnu.org Resolution|--- |WONTFIX --- Comment #5 from kargl at gcc dot gnu.org --- (In reply to vries from comment #0) > Consider this invalid example: > ... > subroutine foo (a, b) > > implicit none > integer :: a > integer :: b > > a = 1 > b = 0 > a = a + 1 > > end subroutine > > program main > implicit none > integer :: a > > call foo(a, a) > > if (a .ne. 1) call abort > > end program main > ... > > The example is invalid because foo is called with aliasing parameters, while > in fortran, we assume that parameters do not alias by annotating them with > restrict, as demonstrated in the original dump: First, there are no parameters (that would be named constants) here. 'a' in the 'main' is an actual argument. 'a' and 'b' in 'foo' are dummy arguments. Second, there is no assumption about aliasing. The Fortran standard explicitly forbids the above code, and the prohibition is on the programmer not the Fortran processor. Third, the Fortran standard does not have a numbered constraint for this invalid code, which means that a Fortran processor is not required to detect and report this invalid code. Indeed, with this code program aaa real a(2) call foo(a,a) end program aaa and no other information, what should a Fortran processor do?