1! { dg-do compile }
2! Tests the fix for PR35470, in which the pointer assignment would fail
3! because the assumed size 'arr' would get mixed up with the component
4! 'p' in the check for the upper bound of an assumed size array.
5!
6! Contributed by Antony Lewis <antony@cosmologist.info>
7!
8subroutine sub(arr)
9  type real_pointer
10    real, pointer :: p(:)
11  end type real_pointer
12  type(real_pointer), dimension(*) :: arr
13  real, pointer :: p(:)
14  p => arr(1)%p
15end subroutine
16