https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98787
Bug ID: 98787 Summary: Aliasing not detected with array elements or some intents Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: jellby at yahoo dot com Target Milestone: --- With -Waliasing (or -Wall), passing the same array as two dummy arguments with "intent(in)" and "intent(out)" is detected and warned about, but not when only an array element (which may be the whole array with assumed size) is passed, or when "intent(inout)" is used. !================================== program main implicit none real :: x(100) integer :: i do i=1,size(x) x(i) = i end do ! no warning for this: call sub(size(x),x(1),x(1)) ! warning for this: call sub(size(x),x,x) contains subroutine sub(n,a,b) implicit none integer, intent(in) :: n ! no warning if one of these is inout: real, intent(in) :: a(n) real, intent(out) :: b(n) b(:) = a(:) end subroutine sub end program main !==================================