1! RUN: %S/test_errors.sh %s %t %flang -fopenmp
2! REQUIRES: shell
3! OpenMP Version 4.5
4! 2.15.4.1 copyin Clause
5! A common block name that appears in a copyin clause must be declared to be
6! a common block in the same scoping unit in which the copyin clause appears.
7
8subroutine copyin()
9  integer :: a = 10
10  common /cmn/ a
11
12  !$omp threadprivate(/cmn/)
13  call copyin_clause()
14
15  contains
16
17    subroutine copyin_clause()
18      !ERROR: COMMON block must be declared in the same scoping unit in which the OpenMP directive or clause appears
19      !$omp parallel copyin(/cmn/)
20      print *, a
21      !$omp end parallel
22    end subroutine copyin_clause
23
24end subroutine copyin
25