summaryrefslogtreecommitdiff
path: root/flang/test/Semantics/OpenMP/threadprivate05.f90
blob: cdbf3701b70ae5808f466a19631e627c428c691e (plain)
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
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Version 5.1
! Check OpenMP construct validity for the following directives:
! 2.21.2 Threadprivate Directive

module mod0
  integer :: mi

contains
  subroutine subm()
    integer, save :: mmi

    !ERROR: The THREADPRIVATE directive and the common block or variable in it must appear in the same declaration section of a scoping unit
    !$omp threadprivate(mi)
    mi = 1
  contains
    subroutine subsubm()
      !ERROR: The THREADPRIVATE directive and the common block or variable in it must appear in the same declaration section of a scoping unit
      !$omp threadprivate(mmi)
    end
  end
end

module mod1
  integer :: mod_i
end

program main
  use mod1
  integer, save :: i
  integer :: j

  !ERROR: The THREADPRIVATE directive and the common block or variable in it must appear in the same declaration section of a scoping unit
  !$omp threadprivate(mod_i)

contains
  subroutine sub()
    !ERROR: The THREADPRIVATE directive and the common block or variable in it must appear in the same declaration section of a scoping unit
    !ERROR: The THREADPRIVATE directive and the common block or variable in it must appear in the same declaration section of a scoping unit
    !$omp threadprivate(i, j)
    i = 1
    j = 1
  end
end