Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / OpenMP / nested-target.f90
blobc130d806b62ac88046bba52e9d976c71cc4ca565
1 ! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp -Werror
3 ! OpenMP Version 5.0
4 ! Check OpenMP construct validity for the following directives:
5 ! 2.12.5 Target Construct
7 program main
8 integer :: i, j, N = 10
9 real :: a, arrayA(512), arrayB(512), ai(10)
10 real, allocatable :: B(:)
12 !$omp target
13 !PORTABILITY: If TARGET UPDATE directive is nested inside TARGET region, the behaviour is unspecified
14 !$omp target update from(arrayA) to(arrayB)
15 do i = 1, 512
16 arrayA(i) = arrayB(i)
17 end do
18 !$omp end target
20 !$omp parallel
21 !$omp target
22 !$omp parallel
23 !PORTABILITY: If TARGET UPDATE directive is nested inside TARGET region, the behaviour is unspecified
24 !$omp target update from(arrayA) to(arrayB)
25 do i = 1, 512
26 arrayA(i) = arrayB(i)
27 end do
28 !$omp end parallel
29 !$omp end target
30 !$omp end parallel
32 !$omp target
33 !PORTABILITY: If TARGET DATA directive is nested inside TARGET region, the behaviour is unspecified
34 !$omp target data map(to: a)
35 do i = 1, N
36 a = 3.14
37 end do
38 !$omp end target data
39 !$omp end target
41 allocate(B(N))
42 !$omp target
43 !PORTABILITY: If TARGET ENTER DATA directive is nested inside TARGET region, the behaviour is unspecified
44 !$omp target enter data map(alloc:B)
45 !$omp end target
47 !$omp target
48 !PORTABILITY: If TARGET EXIT DATA directive is nested inside TARGET region, the behaviour is unspecified
49 !$omp target exit data map(delete:B)
50 !$omp end target
51 deallocate(B)
53 end program main