This supports the following checks for THREADPRIVATE Directive: ``` [5.1] 2.21.2 THREADPRIVATE Directive A threadprivate variable must not appear in any clause except the copyin, copyprivate, schedule, num_threads, thread_limit, and if clauses. ``` This supports the following checks for DECLARE TARGET Directive: ``` [5.1] 2.14.7 Declare Target Directive A threadprivate variable cannot appear in the directive. ``` Besides, procedure name and the entity with PARAMETER attribute cannot be in the threadprivate directive. The main program name and module name cannot be in the threadprivate directive and declare target directive. There is no clear description or restriction about the entity with PARAMETER attribute in OpenMP 5.1 Specification, and a warning is given. Reviewed By: kiranchandramohan, shraiysh, NimishMishra Differential Revision: https://reviews.llvm.org/D114941
28 lines
725 B
Fortran
28 lines
725 B
Fortran
! 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 mod1
|
|
end
|
|
|
|
program main
|
|
use mod1
|
|
integer, parameter :: i = 1
|
|
|
|
!ERROR: The module name or main program name cannot be in a THREADPRIVATE directive
|
|
!$omp threadprivate(mod1)
|
|
|
|
!ERROR: The module name or main program name cannot be in a THREADPRIVATE directive
|
|
!$omp threadprivate(main)
|
|
|
|
!ERROR: The entity with PARAMETER attribute cannot be in a THREADPRIVATE directive
|
|
!$omp threadprivate(i)
|
|
|
|
contains
|
|
subroutine sub()
|
|
!ERROR: The procedure name cannot be in a THREADPRIVATE directive
|
|
!$omp threadprivate(sub)
|
|
end
|
|
end
|