summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/associate_56.f90
blob: 429f129da6e7fc8b811e1c52f3ce6f3ee4af498e (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
! { dg-do compile }
!
! Test the fix for PR93701.
!
! Contributed by Simon Brass  <simon.brass@desy.de>
!
module test
  implicit none

  integer, parameter :: N_STATE = 1, &
       TEST_STATE = 1

  type :: test_t
     integer, dimension(:), allocatable :: state
  end type test_t

contains

  subroutine test_allocate (obj)
    class(test_t), intent(out) :: obj
    allocate (obj%state(N_STATE))
  end subroutine test_allocate


  subroutine test_alter_state2 (obj, a)
    class(test_t), intent(inout) :: obj
    integer, intent(in) :: a
    integer, dimension(2) :: TEST_STATES = [1,2]
    associate (state => obj%state(TEST_STATES))
      state = a                                 ! { dg-error "vector-indexed target" }
      state(TEST_STATE) = a                     ! { dg-error "vector-indexed target" }
    end associate
  end subroutine test_alter_state2

end module test