File: declare-target02.f90

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (152 lines) | stat: -rw-r--r-- 5,865 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Version 5.1
! Check OpenMP construct validity for the following directives:
! 2.14.7 Declare Target Directive

program declare_target02
  integer :: arr1(10), arr1_to(10), arr1_link(10)
  common /blk1/ a1, a1_to, a1_link
  real, save :: eq_a, eq_b, eq_c, eq_d


  !$omp declare target (arr1)

  !$omp declare target (blk1)

  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
  !$omp declare target (a1)

  !$omp declare target to (arr1_to)

  !$omp declare target to (blk1_to)

  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
  !$omp declare target to (a1_to)

  !$omp declare target link (arr1_link)

  !$omp declare target link (blk1_link)

  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
  !$omp declare target link (a1_link)

  equivalence(eq_a, eq_b)
  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
  !$omp declare target (eq_a)

  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
  !$omp declare target to (eq_a)

  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
  !$omp declare target link (eq_b)

  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
  !$omp declare target (eq_c)

  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
  !$omp declare target to (eq_c)

  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
  !$omp declare target link (eq_d)
  equivalence(eq_c, eq_d)

contains
  subroutine func()
    integer :: arr2(10), arr2_to(10), arr2_link(10)
    integer, save :: arr3(10), arr3_to(10), arr3_link(10)
    common /blk2/ a2, a2_to, a2_link
    common /blk3/ a3, a3_to, a3_link
    save /blk3/

    !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
    !$omp declare target (arr2)

    !$omp declare target (arr3)

    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
    !$omp declare target (a2)

    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
    !$omp declare target (a3)

    !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
    !$omp declare target to (arr2_to)

    !$omp declare target to (arr3_to)

    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
    !$omp declare target to (a2_to)

    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
    !$omp declare target to (a3_to)

    !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
    !$omp declare target link (arr2_link)

    !$omp declare target link (arr3_link)

    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
    !$omp declare target link (a2_link)

    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
    !$omp declare target link (a3_link)
  end
end

module mod4
  integer :: arr4(10), arr4_to(10), arr4_link(10)
  common /blk4/ a4, a4_to, a4_link

  !$omp declare target (arr4)

  !$omp declare target (blk4)

  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
  !$omp declare target (a4)

  !$omp declare target to (arr4_to)

  !$omp declare target to (blk4_to)

  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
  !$omp declare target to (a4_to)

  !$omp declare target link (arr4_link)

  !$omp declare target link (blk4_link)

  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
  !$omp declare target link (a4_link)
end

subroutine func5()
  integer :: arr5(10), arr5_to(10), arr5_link(10)
  common /blk5/ a5, a5_to, a5_link

  !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
  !$omp declare target (arr5)

  !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
  !$omp declare target (blk5)

  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
  !$omp declare target (a5)

  !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
  !$omp declare target to (arr5_to)

  !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
  !$omp declare target to (blk5_to)

  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
  !$omp declare target to (a5_to)

  !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
  !$omp declare target link (arr5_link)

  !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
  !$omp declare target link (blk5_link)

  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
  !$omp declare target link (a5_link)
end