annotate libgomp/testsuite/libgomp.fortran/associate2.f90 @ 143:76e1cf5455ef

add cbc_gc test
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 19:24:05 +0900
parents 84e7813d76e9
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ! { dg-do run }
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 program associate2
kono
parents:
diff changeset
4 type dl
kono
parents:
diff changeset
5 integer :: i
kono
parents:
diff changeset
6 end type
kono
parents:
diff changeset
7 type dt
kono
parents:
diff changeset
8 integer :: i
kono
parents:
diff changeset
9 real :: a(3, 3)
kono
parents:
diff changeset
10 type(dl) :: c(3, 3)
kono
parents:
diff changeset
11 end type
kono
parents:
diff changeset
12 integer :: v(4), i, j, k, l
kono
parents:
diff changeset
13 type (dt) :: a(3, 3)
kono
parents:
diff changeset
14 v = 15
kono
parents:
diff changeset
15 forall (k = 1:3, l = 1:3) a(k, l)%a(:,:) = 4.5
kono
parents:
diff changeset
16 a(2,1)%a(1,2) = 3.5
kono
parents:
diff changeset
17 i = 2
kono
parents:
diff changeset
18 j = 1
kono
parents:
diff changeset
19 associate(u => v, b => a(i, j)%a)
kono
parents:
diff changeset
20 !$omp parallel private(v, a) default(none)
kono
parents:
diff changeset
21 v = -1
kono
parents:
diff changeset
22 forall (k = 1:3, l = 1:3) a(k, l)%a(:,:) = 2.5
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
23 if (v(3) /= -1 .or. u(3) /= 15) STOP 1
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
24 if (a(2,1)%a(1,2) /= 2.5 .or. b(1,2) /= 3.5) STOP 2
111
kono
parents:
diff changeset
25 associate(u => v, b => a(2, 1)%a)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
26 if (u(3) /= -1 .or. b(1,2) /= 2.5) STOP 3
111
kono
parents:
diff changeset
27 end associate
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
28 if (u(3) /= 15 .or. b(1,2) /= 3.5) STOP 4
111
kono
parents:
diff changeset
29 !$omp end parallel
kono
parents:
diff changeset
30 end associate
kono
parents:
diff changeset
31 forall (k = 1:3, l = 1:3) a(k, l)%c(:,:)%i = 7
kono
parents:
diff changeset
32 a(1,2)%c(2,1)%i = 9
kono
parents:
diff changeset
33 i = 1
kono
parents:
diff changeset
34 j = 2
kono
parents:
diff changeset
35 associate(d => a(i, j)%c(2,:)%i)
kono
parents:
diff changeset
36 !$omp parallel private(a) default(none)
kono
parents:
diff changeset
37 forall (k = 1:3, l = 1:3) a(k, l)%c(:,:)%i = 15
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
38 if (a(1,2)%c(2,1)%i /= 15 .or. d(1) /= 9) STOP 5
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
39 if (a(1,2)%c(2,2)%i /= 15 .or. d(2) /= 7) STOP 6
111
kono
parents:
diff changeset
40 associate(d => a(2,1)%c(2,:)%i)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
41 if (d(1) /= 15 .or. d(2) /= 15) STOP 7
111
kono
parents:
diff changeset
42 end associate
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
43 if (d(1) /= 9 .or. d(2) /= 7) STOP 8
111
kono
parents:
diff changeset
44 !$omp end parallel
kono
parents:
diff changeset
45 end associate
kono
parents:
diff changeset
46 end program