xref: /llvm-project/flang/test/Semantics/OpenMP/declare-target05.f90 (revision 502bea25bdc07d1811b8bfea1c2e6bfa8617f72f)
1! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
2! OpenMP Version 5.1
3! Check OpenMP construct validity for the following directives:
4! 2.14.7 Declare Target Directive
5
6module mod0
7  integer :: mi
8
9contains
10  subroutine subm()
11    integer, save :: mmi
12
13    !ERROR: The DECLARE TARGET directive and the common block or variable in it must appear in the same declaration section of a scoping unit
14    !$omp declare target (mi)
15    mi = 1
16  contains
17    subroutine subsubm()
18      !ERROR: The DECLARE TARGET directive and the common block or variable in it must appear in the same declaration section of a scoping unit
19      !$omp declare target (mmi)
20    end
21  end
22end
23
24module mod1
25  integer :: mod_i
26end
27
28program main
29  use mod1
30  integer, save :: i
31  integer :: j
32
33  !ERROR: The DECLARE TARGET directive and the common block or variable in it must appear in the same declaration section of a scoping unit
34  !$omp declare target (mod_i)
35
36contains
37  subroutine sub()
38    !ERROR: The DECLARE TARGET directive and the common block or variable in it must appear in the same declaration section of a scoping unit
39    !ERROR: The DECLARE TARGET directive and the common block or variable in it must appear in the same declaration section of a scoping unit
40    !$omp declare target (i, j)
41    i = 1
42    j = 1
43  end
44end
45