aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/associate_43.f90
blob: a1460efc371903190998e3311300e9854c1fbc9b (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
! { dg-do run }
!
! Check that PR83146 remains fixed.
!
! Contributed by Neil Carlson  <neil.n.carlson@gmail.com>
!
  type foo
    integer n
  end type
  type bar
    type(foo) array(2)
  end type

  type(bar) b
  integer :: m=0

  b%array(1)%n = 42
  b%array(2)%n = 43

  call assoc(1)
  m = 1
  call assoc(2)
contains
  subroutine assoc (n)
    integer :: n
    associate (n_array => b%array%n)
      select case (n_array(n))
        case (42)
          if (m .ne. 0) stop 1
      case default
          if (m .eq. 0) stop 2
      end select
    end associate
  end subroutine assoc
end