testsuite: Fix up gcc.target/powerpc/safe-indirect-jump-3.c test [PR117444]
[official-gcc.git] / libgomp / testsuite / libgomp.fortran / target2.f90
blob11b8af737e37112ea70de74dcbf2a0cb3a343a6b
1 ! { dg-do run }
2 ! { dg-options "-ffree-line-length-160" }
4 module target2
5 contains
6 subroutine foo (a, b, c, d, e, f, g, n, q)
7 integer :: n, q
8 integer :: a, b(3:n), c(5:), d(2:*), e(:,:)
9 integer, pointer :: f, g(:)
10 integer :: h, i(3:n)
11 integer, pointer :: j, k(:)
12 logical :: r
13 allocate (j, k(4:n))
14 h = 14
15 i = 15
16 j = 16
17 k = 17
18 !$omp target map (to: a, b, c, d(2:n+1), e, f, g, h, i, j, k, n) map (from: r)
19 r = a /= 7
20 r = r .or. (any (b /= 8)) .or. (lbound (b, 1) /= 3) .or. (ubound (b, 1) /= n)
21 r = r .or. (any (c /= 9)) .or. (lbound (c, 1) /= 5) .or. (ubound (c, 1) /= n + 4)
22 r = r .or. (any (d(2:n+1) /= 10)) .or. (lbound (d, 1) /= 2)
23 r = r .or. (any (e /= 11)) .or. (lbound (e, 1) /= 1) .or. (ubound (e, 1) /= 2)
24 r = r .or. (lbound (e, 2) /= 1) .or. (ubound (e, 2) /= 2)
25 r = r .or. (f /= 12)
26 r = r .or. (any (g /= 13)) .or. (lbound (g, 1) /= 3) .or. (ubound (g, 1) /= n)
27 r = r .or. (h /= 14)
28 r = r .or. (any (i /= 15)) .or. (lbound (i, 1) /= 3) .or. (ubound (i, 1) /= n)
29 r = r .or. (j /= 16)
30 r = r .or. (any (k /= 17)) .or. (lbound (k, 1) /= 4) .or. (ubound (k, 1) /= n)
31 !$omp end target
32 if (r) stop 1
33 !$omp target map (to: b(3:n), c(5:n+4), d(2:n+1), e(1:,:2), g(3:n), i(3:n), k(4:n), n) map (from: r)
34 r = (any (b /= 8)) .or. (lbound (b, 1) /= 3) .or. (ubound (b, 1) /= n)
35 r = r .or. (any (c /= 9)) .or. (lbound (c, 1) /= 5) .or. (ubound (c, 1) /= n + 4)
36 r = r .or. (any (d(2:n+1) /= 10)) .or. (lbound (d, 1) /= 2)
37 r = r .or. (any (e /= 11)) .or. (lbound (e, 1) /= 1) .or. (ubound (e, 1) /= 2)
38 r = r .or. (lbound (e, 2) /= 1) .or. (ubound (e, 2) /= 2)
39 r = r .or. (any (g /= 13)) .or. (lbound (g, 1) /= 3) .or. (ubound (g, 1) /= n)
40 r = r .or. (any (i /= 15)) .or. (lbound (i, 1) /= 3) .or. (ubound (i, 1) /= n)
41 r = r .or. (any (k /= 17)) .or. (lbound (k, 1) /= 4) .or. (ubound (k, 1) /= n)
42 !$omp end target
43 if (r) stop 2
44 !$omp target map (to: b(5:n-2), c(7:n), d(4:n-2), e(1:,2:), g(5:n-3), i(6:n-4), k(5:n-5), n) map (from: r)
45 r = (any (b(5:n-2) /= 8)) .or. (lbound (b, 1) /= 3) .or. (ubound (b, 1) /= n)
46 r = r .or. (any (c(7:n) /= 9)) .or. (lbound (c, 1) /= 5) .or. (ubound (c, 1) /= n + 4)
47 r = r .or. (any (d(4:n-2) /= 10)) .or. (lbound (d, 1) /= 2)
48 r = r .or. (any (e(1:,2:) /= 11)) .or. (lbound (e, 1) /= 1) .or. (ubound (e, 1) /= 2)
49 r = r .or. (lbound (e, 2) /= 1) .or. (ubound (e, 2) /= 2)
50 r = r .or. (any (g(5:n-3) /= 13)) .or. (lbound (g, 1) /= 3) .or. (ubound (g, 1) /= n)
51 r = r .or. (any (i(6:n-4) /= 15)) .or. (lbound (i, 1) /= 3) .or. (ubound (i, 1) /= n)
52 r = r .or. (any (k(5:n-5) /= 17)) .or. (lbound (k, 1) /= 4) .or. (ubound (k, 1) /= n)
53 !$omp end target
54 !$omp target map (to: b(q+5:n-2+q), c(q+7:q+n), d(q+4:q+n-2), e(1:q+2,2:q+2), g(5+q:n-3+q), &
55 !$omp & i(6+q:n-4+q), k(5+q:n-5+q), n) map (from: r)
56 r = (any (b(5:n-2) /= 8)) .or. (lbound (b, 1) /= 3) .or. (ubound (b, 1) /= n)
57 r = r .or. (any (c(7:n) /= 9)) .or. (lbound (c, 1) /= 5) .or. (ubound (c, 1) /= n + 4)
58 r = r .or. (any (d(4:n-2) /= 10)) .or. (lbound (d, 1) /= 2)
59 r = r .or. (any (e(1:,2:) /= 11)) .or. (lbound (e, 1) /= 1) .or. (ubound (e, 1) /= 2)
60 r = r .or. (lbound (e, 2) /= 1) .or. (ubound (e, 2) /= 2)
61 r = r .or. (any (g(5:n-3) /= 13)) .or. (lbound (g, 1) /= 3) .or. (ubound (g, 1) /= n)
62 r = r .or. (any (i(6:n-4) /= 15)) .or. (lbound (i, 1) /= 3) .or. (ubound (i, 1) /= n)
63 r = r .or. (any (k(5:n-5) /= 17)) .or. (lbound (k, 1) /= 4) .or. (ubound (k, 1) /= n)
64 !$omp end target
65 if (r) stop 3
66 !$omp target map (to: d(2:n+1), n)
67 r = a /= 7
68 r = r .or. (any (b /= 8)) .or. (lbound (b, 1) /= 3) .or. (ubound (b, 1) /= n)
69 r = r .or. (any (c /= 9)) .or. (lbound (c, 1) /= 5) .or. (ubound (c, 1) /= n + 4)
70 r = r .or. (any (d(2:n+1) /= 10)) .or. (lbound (d, 1) /= 2)
71 r = r .or. (any (e /= 11)) .or. (lbound (e, 1) /= 1) .or. (ubound (e, 1) /= 2)
72 r = r .or. (lbound (e, 2) /= 1) .or. (ubound (e, 2) /= 2)
73 r = r .or. (f /= 12)
74 r = r .or. (any (g /= 13)) .or. (lbound (g, 1) /= 3) .or. (ubound (g, 1) /= n)
75 r = r .or. (h /= 14)
76 r = r .or. (any (i /= 15)) .or. (lbound (i, 1) /= 3) .or. (ubound (i, 1) /= n)
77 r = r .or. (j /= 16)
78 r = r .or. (any (k /= 17)) .or. (lbound (k, 1) /= 4) .or. (ubound (k, 1) /= n)
79 !$omp end target
80 if (r) stop 4
81 end subroutine foo
82 end module target2
83 use target2, only : foo
84 integer, parameter :: n = 15, q = 0
85 integer :: a, b(2:n-1), c(n), d(n), e(3:4, 3:4)
86 integer, pointer :: f, g(:)
87 allocate (f, g(3:n))
88 a = 7
89 b = 8
90 c = 9
91 d = 10
92 e = 11
93 f = 12
94 g = 13
95 call foo (a, b, c, d, e, f, g, n, q)
96 end