[memprof] Move YAML support to MemProfYAML.h (NFC) (#119515)
[llvm-project.git] / flang / test / Semantics / OpenMP / reduction-namelist.f90
blobedae3d7aef2c5d1197f974b0b14cfcef9f0b29c3
1 ! RUN: %python %S/../test_errors.py %s %flang -fopenmp
2 ! This is not actually disallowed by the OpenMP standard, but it is not allowed
3 ! for privatisation - this seems like an oversight.
5 module test
6 integer :: a, b, c
7 namelist /nlist1/ a, b
8 end module
10 program omp_reduction
11 use test
13 integer :: p(10) ,q(10)
14 namelist /nlist2/ c, d
16 a = 5
17 b = 10
18 c = 100
20 !ERROR: Variable 'd' in NAMELIST cannot be in a REDUCTION clause
21 !ERROR: Variable 'a' in NAMELIST cannot be in a REDUCTION clause
22 !$omp parallel reduction(+:d) reduction(+:a)
23 d = a + b
24 a = d
25 !$omp end parallel
27 call sb()
29 contains
30 subroutine sb()
31 namelist /nlist3/ p, q
33 !ERROR: Variable 'p' in NAMELIST cannot be in a REDUCTION clause
34 !ERROR: Variable 'q' in NAMELIST cannot be in a REDUCTION clause
35 !$omp parallel reduction(+:p) reduction(+:q)
36 p = c * b
37 q = p * d
38 !$omp end parallel
40 write(*, nlist1)
41 write(*, nlist2)
42 write(*, nlist3)
44 end subroutine
46 end program omp_reduction