1 ! RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=52
3 ! Check OpenMP declarative directives
5 !TODO: all internal errors
6 ! enable declare-reduction example after name resolution
10 subroutine requires_1(a
)
11 real(8), intent(inout
) :: a
12 !$omp requires reverse_offload, unified_shared_memory, atomic_default_mem_order(relaxed)
14 end subroutine requires_1
16 subroutine requires_2(a
)
17 real(8), intent(inout
) :: a
18 !$omp requires unified_address
20 end subroutine requires_2
24 subroutine declare_simd_1(a
, b
)
25 real(8), intent(inout
) :: a
, b
26 !$omp declare simd(declare_simd_1) aligned(a)
28 end subroutine declare_simd_1
33 integer, intent(in
)::x
34 integer, intent(in
)::y
39 subroutine declare_simd_2
42 !ERROR: NOTINBRANCH and INBRANCH clauses are mutually exclusive and may not appear on the same DECLARE SIMD directive
43 !$omp declare simd(sub1) inbranch notinbranch
44 procedure (sub
), pointer::p
47 end subroutine declare_simd_2
50 integer, intent(in
)::x
, y
54 ! 2.10.6 declare-target
55 ! 2.15.2 threadprivate
61 !WARNING: The entity with PARAMETER attribute is used in a DECLARE TARGET directive
62 !WARNING: The entity with PARAMETER attribute is used in a DECLARE TARGET directive
63 !$omp declare target (foo, N, M)
64 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
65 !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
66 !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
67 !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
68 !$omp declare target to(Q, S) link(R)
69 !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
70 !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
71 !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
72 !$omp declare target enter(Q, S) link(R)
73 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
74 !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
75 !ERROR: MAP clause is not allowed on the DECLARE TARGET directive
76 !$omp declare target to(Q) map(from:Q)
77 !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
78 !ERROR: MAP clause is not allowed on the DECLARE TARGET directive
79 !$omp declare target enter(Q) map(from:Q)
80 integer, parameter :: N
=10000, M
=1024
82 real :: Q(N
, N
), R(N
,M
), S(M
,M
)
83 !ERROR: A variable that appears in a THREADPRIVATE directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
84 !$omp threadprivate(i)
88 ! 2.16 declare-reduction
90 ! subroutine declare_red_1()
93 ! !$omp declare reduction (my_add_red : integer : omp_out = omp_out + omp_in) initializer (omp_priv=0)
95 ! !$omp parallel reduction (my_add_red : my_var) num_threads(4)
96 ! my_var = omp_get_thread_num() + 1
98 ! print *, "sum of thread numbers is ", my_var
99 ! end subroutine declare_red_1