34 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp2! OpenMP Version 5.13! Check OpenMP construct validity for the following directives:4! 2.21.2 Threadprivate Directive5 6subroutine host_assoc_fail()7 integer :: i8 ! ERROR: A variable that appears in a THREADPRIVATE directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly9 !$omp threadprivate(i)10 real :: r11 ! ERROR: A variable that appears in a THREADPRIVATE directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly12 !$omp threadprivate(r)13contains14 subroutine internal()15!$omp parallel16 print *, i, r17!$omp end parallel18 end subroutine internal19end subroutine host_assoc_fail20 21! This sub-test is not supposed to emit a compiler error.22subroutine host_assoc()23 integer, save :: i24 !$omp threadprivate(i)25 real, save :: r26 !$omp threadprivate(r)27contains28 subroutine internal()29!$omp parallel30 print *, i, r31!$omp end parallel32 end subroutine internal33end subroutine host_assoc34