Debian Codegraph @

gcc/testsuite/gfortran.dg/associate_20.f03

raw
1 ! { dg-do run }
2 !
3 ! Contributed by [email protected]
4 ! Adapated by Andre Vehreschild <[email protected]>
5 ! Test that fix for PR69296 is working.
6
7 program p
8 implicit none
9
10 type foo
11 integer :: i
12 end type
13
14 integer :: j, i(3,2)
15 class(foo), allocatable :: a(:,:)
16
17 allocate (a(2,6))
18
19 a(1,:)%i = (/ ( j , j=1,6) /)
20 a(2,:)%i = (/ ( -10*j , j=1,6) /)
21
22 i(:,1) = (/ 1 , 3 , 5 /)
23 i(:,2) = (/ 4 , 5 , 6 /)
24
25 associate( ai => a(:,i(:,1))%i )
26 if (any(shape(ai) /= [2, 3])) STOP 1
27 if (any(reshape(ai, [6]) /= [1 , -10, 3, -30, 5, -50])) STOP 2
28 end associate
29
30 deallocate(a)
31 end program p