summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/PR100094.f90
blob: f2f7f1631dcf60adb0035a9adf210ece4069efb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
! { dg-do run }
!
! Test the fix for PR100094
!

program foo_p

  implicit none

  integer, parameter :: n = 11
  
  integer, pointer :: pout(:)
  integer,  target :: a(n)
  integer          :: i
  
  a = [(i, i=1,n)]
  call foo(pout)
  if(.not.associated(pout)) stop 1
  if(.not.associated(pout, a)) stop 2
  if(any(pout/=a)) stop 3
  stop

contains

  subroutine foo(that)
    integer, pointer, intent(out) :: that(..)

    select rank(that)
    rank(1)
      that => a
    rank default
      stop 4
    end select
    return
  end subroutine foo

end program foo_p