https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126333
--- Comment #7 from Harald Anlauf <anlauf at gcc dot gnu.org> ---
A variation of the previous testcase:
% cat pr126333-z4.f90
subroutine zero_n (x, n)
integer, intent(in) :: n
integer, pointer :: x(:)
integer, pointer :: p(:)
p => x(1:n)
call zero (p)
contains
subroutine zero (y)
integer, intent(out) :: y(:)
y = 0
end subroutine zero
end
% gfc-17 -Wall pr126333-z4.f90 -c
pr126333-z4.f90:5:7:
5 | p => x(1:n)
| 1
Warning: Variable »p« defined at (1) but never used
[-Wunused-but-set-variable=]
p is dereferenced in the subroutine call.