Debian Codegraph @

libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90

raw
1 ! { dg-do run }
2
3 ! { dg-additional-options "-fopt-info-note-omp" }
4 ! { dg-additional-options "--param=openacc-privatization=noisy" }
5 ! { dg-additional-options "-foffload=-fopt-info-note-omp" }
6 ! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
7 ! for testing/documenting aspects of that functionality.
8 ! Prune a few: uninteresting, and varying depending on GCC configuration (data types):
9 ! { dg-prune-output {note: variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} }
10
11 ! { dg-additional-options -Wuninitialized }
12
13 ! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
14 ! passed to 'incr' may be unset, and in that case, it will be set to [...]",
15 ! so to maintain compatibility with earlier Tcl releases, we manually
16 ! initialize counter variables:
17 ! { dg-line l_dummy[variable c_compute 0 c_loop 0] }
18 ! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
19 ! "WARNING: dg-line var l_dummy defined, but not used". */
20
21 program main
22 implicit none (type, external)
23 integer :: j
24 integer, allocatable :: A(:)
25 character(len=:), allocatable :: my_str
26 character(len=15), allocatable :: my_str15
27
28 A = [(3*j, j=1, 10)]
29 call foo (A, size(A))
30 call bar (A)
31 my_str = "1234567890"
32 call foo_str(my_str)
33 call bar_str(my_str)
34 my_str15 = "123456789012345"
35 call foobar (my_str15)
36 deallocate (A, my_str, my_str15)
37 contains
38 subroutine foo (array, nn)
39 integer :: i, nn
40 integer :: array(nn)
41
42 !$acc parallel copyout(array) ! { dg-line l_compute[incr c_compute] }
43 ! { dg-note {variable 'atmp\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
44 ! { dg-note {variable 'shadow_loopvar\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
45 ! { dg-note {variable 'offset\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
46 ! { dg-note {variable 'S\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
47 array = [(-i, i = 1, nn)]
48 !$acc end parallel
49 !$acc parallel copy(array)
50 !$acc loop gang private(array) ! { dg-line l_loop[incr c_loop] }
51 ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
52 ! { dg-note {variable 'array' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
53 ! { dg-note {variable 'array' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_loop$c_loop }
54 ! { dg-note {variable 'array' adjusted for OpenACC privatization level: 'gang'} "" { target { ! { openacc_host_selected || { openacc_nvidia_accel_selected && __OPTIMIZE__ } } } } l_loop$c_loop }
55 do i = 1, 10
56 array(i) = i
57 end do
58 !$acc end parallel
59 !$acc parallel copyin(array) ! { dg-line l_compute[incr c_compute] }
60 ! { dg-note {variable 'test\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
61 ! { dg-note {variable 'atmp\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
62 ! { dg-note {variable 'shadow_loopvar\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
63 ! { dg-note {variable 'offset\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
64 ! { dg-note {variable 'S\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
65 if (any (array /= [(-i, i = 1, nn)])) error stop 1
66 !$acc end parallel
67 end subroutine foo
68 subroutine bar (array)
69 integer :: i
70 integer :: array(:)
71
72 !$acc parallel copyout(array) ! { dg-line l_compute[incr c_compute] }
73 ! { dg-note {variable 'atmp\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
74 ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
75 ! { dg-note {variable 'shadow_loopvar\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
76 ! { dg-note {variable 'offset\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
77 ! { dg-note {variable 'S\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
78 array = [(-2*i, i = 1, size(array))]
79 !$acc end parallel
80 !$acc parallel copy(array)
81 !$acc loop gang private(array) ! { dg-line l_loop[incr c_loop] }
82 ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
83 ! { dg-note {variable 'array\.[0-9]+' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
84 ! { dg-note {variable 'array\.[0-9]+' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_loop$c_loop }
85 ! { dg-note {variable 'array\.[0-9]+' adjusted for OpenACC privatization level: 'gang'} "" { target { ! { openacc_host_selected || { openacc_nvidia_accel_selected && __OPTIMIZE__ } } } } l_loop$c_loop }
86 do i = 1, 10
87 array(i) = 9*i
88 end do
89 !$acc end parallel
90 !$acc parallel copyin(array) ! { dg-line l_compute[incr c_compute] }
91 ! { dg-note {variable 'test\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
92 ! { dg-note {variable 'A\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: static} "" { target *-*-* } l_compute$c_compute }
93 ! { dg-note {variable 'S\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
94 if (any (array /= [(-2*i, i = 1, 10)])) error stop 2
95 !$acc end parallel
96 end subroutine bar
97 subroutine foo_str(str)
98 integer :: i
99 character(len=*) :: str
100
101 !$acc parallel copyout(str)
102 str = "abcdefghij"
103 !$acc end parallel
104 !$acc parallel copy(str)
105 !$acc loop gang private(str) ! { dg-line l_loop[incr c_loop] }
106 ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
107 ! { dg-note {variable 'str' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
108 ! { dg-note {variable 'str' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_loop$c_loop }
109 ! { dg-note {variable 'str' adjusted for OpenACC privatization level: 'gang'} "" { target { ! { openacc_host_selected || { openacc_nvidia_accel_selected && __OPTIMIZE__ } } } } l_loop$c_loop }
110 ! { dg-note {variable 'char\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target *-*-* } l_loop$c_loop }
111 do i = 1, 10
112 str(i:i) = achar(ichar('A') + i)
113 end do
114 !$acc end parallel
115 !$acc parallel copyin(str)
116 if (str /= "abcdefghij") error stop 3
117 !$acc end parallel
118 end
119 subroutine bar_str(str)
120 integer :: i
121 character(len=:), allocatable :: str
122
123 ! ***************************************
124 ! FIXME: Fails due to PR middle-end/95499
125 ! ***************************************
126 !!$acc parallel copyout(str)
127 str = "abcdefghij"
128 !!$acc end parallel
129 !!$acc parallel copy(str)
130 !!$acc loop gang private(str)
131 !do i = 1, 10
132 ! str(i:i) = achar(ichar('A') + i)
133 !end do
134 !!$acc end parallel
135 !!$acc parallel copyin(str)
136 if (str /= "abcdefghij") error stop 5
137 !!$acc end parallel
138 end
139 subroutine foobar (scalar)
140 integer :: i
141 character(len=15), optional :: scalar
142
143 !$acc parallel copyout(scalar)
144 scalar = "abcdefghi-12345"
145 !$acc end parallel
146 !$acc parallel copy(scalar)
147 !$acc loop gang private(scalar) ! { dg-line l_loop[incr c_loop] }
148 ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
149 ! { dg-note {variable 'scalar' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
150 ! { dg-note {variable 'scalar' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_loop$c_loop }
151 ! { dg-note {variable 'scalar' adjusted for OpenACC privatization level: 'gang'} "" { target { ! { openacc_host_selected || { openacc_nvidia_accel_selected && __OPTIMIZE__ } } } } l_loop$c_loop }
152 ! { dg-note {variable 'char\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target *-*-* } l_loop$c_loop }
153 do i = 1, 15
154 scalar(i:i) = achar(ichar('A') + i)
155 end do
156 !$acc end parallel
157 !$acc parallel copyin(scalar)
158 if (scalar /= "abcdefghi-12345") error stop 6
159 !$acc end parallel
160 end subroutine foobar
161 subroutine foobar15 (scalar)
162 integer :: i
163 character(len=15), optional, allocatable :: scalar
164
165 !$acc parallel copyout(scalar)
166 scalar = "abcdefghi-12345"
167 !$acc end parallel
168 !$acc parallel copy(scalar)
169 !$acc loop gang private(scalar)
170 do i = 1, 15
171 scalar(i:i) = achar(ichar('A') + i)
172 end do
173 !$acc end parallel
174 !$acc parallel copyin(scalar)
175 if (scalar /= "abcdefghi-12345") error stop 1
176 !$acc end parallel
177 end subroutine foobar15
178 end