xref: /llvm-project/flang/test/Semantics/OpenMP/threadprivate06.f90 (revision 9f0e59f3c1a56fd14025df973c9f944010efe09a)
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.21.2 Threadprivate Directive
5
6program main
7  call sub1()
8  print *, 'pass'
9end program main
10
11subroutine sub1()
12  common /c/ a
13  !$omp threadprivate(/c/)
14  integer :: a
15
16  a = 100
17  call sub2()
18  if (a .ne. 101) print *, 'err'
19
20contains
21  subroutine sub2()
22    common /c/ a
23    !$omp threadprivate(/c/)
24    integer :: a
25
26    !$omp parallel copyin(/c/)
27      a = a + 1
28    !$omp end parallel
29  end subroutine
30end subroutine
31