Debian Codegraph @

gcc/testsuite/gfortran.dg/do_concurrent_12.f90

raw
1 ! { dg-do compile }
2
3 ! Fails to compile because default initializers aren't supported.
4 ! cf. do_concurrent_14.f90 and PR fortran/101602 (comment 6)
5
6 module m
7 implicit none
8 type t
9 integer :: y = 44
10 integer, pointer :: ptr(:) => null()
11 end type t
12
13 contains
14
15 subroutine sub(x, y)
16 integer :: i
17 type(t) :: x, y(4)
18 type(t) :: a, b(3)
19 logical :: error = .false.
20 integer, target :: tgt(6)
21 integer, target :: tgt2(7)
22
23 x%y = 100
24 x%ptr => tgt
25 y(1)%y = 101
26 y(2)%y = 102
27 y(3)%y = 103
28 y(4)%y = 104
29 y(1)%ptr => tgt
30 y(2)%ptr => tgt
31 y(3)%ptr => tgt
32 y(4)%ptr => tgt
33
34 a%y = 105
35 a%ptr => tgt
36 b(1)%y = 106
37 b(2)%y = 107
38 b(3)%y = 108
39 b(1)%ptr => tgt
40 b(2)%ptr => tgt
41 b(3)%ptr => tgt
42
43 do concurrent (i = 1: 3) local_init(x,y,a,b) shared(error,tgt,tgt2) default(none)
44 if (x%y /= 100 &
45 .or. .not.associated (x%ptr, tgt) &
46 .or. y(1)%y /= 101 &
47 .or. y(2)%y /= 102 &
48 .or. y(3)%y /= 103 &
49 .or. y(4)%y /= 104 &
50 .or. .not.associated (y(1)%ptr, tgt) &
51 .or. .not.associated (y(2)%ptr, tgt) &
52 .or. .not.associated (y(3)%ptr, tgt) &
53 .or. .not.associated (y(4)%ptr, tgt) &
54 .or. a%y /= 105 &
55 .or. .not.associated (a%ptr, tgt) &
56 .or. b(1)%y /= 106 &
57 .or. b(2)%y /= 107 &
58 .or. b(3)%y /= 108 &
59 .or. .not.associated (b(1)%ptr, tgt) &
60 .or. .not.associated (b(2)%ptr, tgt) &
61 .or. .not.associated (b(3)%ptr, tgt)) &
62 error = .true.
63
64 x%y = 900
65 x%ptr => tgt
66 y(1)%y = 901
67 y(2)%y = 902
68 y(3)%y = 903
69 y(4)%y = 904
70 y(1)%ptr => tgt2
71 y(2)%ptr => tgt2
72 y(3)%ptr => tgt2
73 y(4)%ptr => tgt2
74
75 a%y = 905
76 a%ptr => tgt
77 b(1)%y = 906
78 b(2)%y = 907
79 b(3)%y = 908
80 b(1)%ptr => tgt2
81 b(2)%ptr => tgt2
82 b(3)%ptr => tgt2
83 end do
84
85 if (error) stop 1
86 if (x%y /= 100 &
87 .or. .not.associated (x%ptr, tgt) &
88 .or. y(1)%y /= 101 &
89 .or. y(2)%y /= 102 &
90 .or. y(3)%y /= 103 &
91 .or. y(4)%y /= 104 &
92 .or. .not.associated (y(1)%ptr, tgt) &
93 .or. .not.associated (y(2)%ptr, tgt) &
94 .or. .not.associated (y(3)%ptr, tgt) &
95 .or. .not.associated (y(4)%ptr, tgt) &
96 .or. a%y /= 105 &
97 .or. .not.associated (a%ptr, tgt) &
98 .or. b(1)%y /= 106 &
99 .or. b(2)%y /= 107 &
100 .or. b(3)%y /= 108 &
101 .or. .not.associated (b(1)%ptr, tgt) &
102 .or. .not.associated (b(2)%ptr, tgt) &
103 .or. .not.associated (b(3)%ptr, tgt)) &
104 stop 2
105
106 do concurrent (i = 1: 3) local(x,y,a,b) shared(error,tgt,tgt2) default(none)
107 ! { dg-error "34: Sorry, LOCAL specifier at .1. for 'x' of derived type with default initializer is not yet supported" "" { target *-*-* } .-1 }
108 ! { dg-error "36: Sorry, LOCAL specifier at .1. for 'y' of derived type with default initializer is not yet supported" "" { target *-*-* } .-2 }
109 ! { dg-error "38: Sorry, LOCAL specifier at .1. for 'a' of derived type with default initializer is not yet supported" "" { target *-*-* } .-3 }
110 ! { dg-error "40: Sorry, LOCAL specifier at .1. for 'b' of derived type with default initializer is not yet supported" "" { target *-*-* } .-4 }
111
112 if (x%y /= 44) error = .true.
113 if (any(y(:)%y /= 44)) error = .true.
114 if (a%y /= 44) error = .true.
115 if (any (b(:)%y /= 44)) error = .true.
116
117 if (associated(x%ptr)) error = .true.
118 if (associated(y(1)%ptr)) error = .true.
119 if (associated(y(2)%ptr)) error = .true.
120 if (associated(y(3)%ptr)) error = .true.
121 if (associated(y(4)%ptr)) error = .true.
122 if (associated(a%ptr)) error = .true.
123 if (associated(b(1)%ptr)) error = .true.
124 if (associated(b(2)%ptr)) error = .true.
125 if (associated(b(3)%ptr)) error = .true.
126
127 x%y = 900
128 x%ptr => tgt
129 y(1)%y = 901
130 y(2)%y = 902
131 y(3)%y = 903
132 y(4)%y = 904
133 y(1)%ptr => tgt2
134 y(2)%ptr => tgt2
135 y(3)%ptr => tgt2
136 y(4)%ptr => tgt2
137
138 a%y = 905
139 a%ptr => tgt
140 b(1)%y = 906
141 b(2)%y = 907
142 b(3)%y = 908
143 b(1)%ptr => tgt2
144 b(2)%ptr => tgt2
145 b(3)%ptr => tgt2
146 end do
147
148 if (error) stop 3
149 if (x%y /= 100 &
150 .or. .not.associated (x%ptr, tgt) &
151 .or. y(1)%y /= 101 &
152 .or. y(2)%y /= 102 &
153 .or. y(3)%y /= 103 &
154 .or. y(4)%y /= 104 &
155 .or. .not.associated (y(1)%ptr, tgt) &
156 .or. .not.associated (y(2)%ptr, tgt) &
157 .or. .not.associated (y(3)%ptr, tgt) &
158 .or. .not.associated (y(4)%ptr, tgt) &
159 .or. a%y /= 105 &
160 .or. .not.associated (a%ptr, tgt) &
161 .or. b(1)%y /= 106 &
162 .or. b(2)%y /= 107 &
163 .or. b(3)%y /= 108 &
164 .or. .not.associated (b(1)%ptr, tgt) &
165 .or. .not.associated (b(2)%ptr, tgt) &
166 .or. .not.associated (b(3)%ptr, tgt)) &
167 stop 4
168 end
169 end
170
171 use m
172 implicit none
173 type(t) :: q, r(4)
174 call sub(q,r)
175 end