1! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp -Werror -pedantic 2 3! OpenMP Version 5.0 4! Check OpenMP construct validity for the following directives: 5! 2.12.5 Target Construct 6 7program main 8 integer :: i, j, N = 10, n1, n2, res(100) 9 real :: a, arrayA(512), arrayB(512), ai(10) 10 real, allocatable :: B(:) 11 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 19 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 31 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 40 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 46 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) 52 53 n1 = 10 54 n2 = 10 55 !$omp target teams map(to:a) 56 !PORTABILITY: If TARGET DATA directive is nested inside TARGET region, the behaviour is unspecified 57 !$omp target data map(n1,n2) 58 do i=1, n1 59 do j=1, n2 60 res((i-1)*10+j) = i*j 61 end do 62 end do 63 !$omp end target data 64 !$omp end target teams 65 66 !$omp target teams map(to:a) map(from:n1,n2) 67 !PORTABILITY: If TARGET TEAMS DISTRIBUTE PARALLEL DO directive is nested inside TARGET region, the behaviour is unspecified 68 !$omp target teams distribute parallel do 69 do i=1, n1 70 do j=1, n2 71 res((i-1)*10+j) = i*j 72 end do 73 end do 74 !$omp end target teams distribute parallel do 75 !$omp end target teams 76 77end program main 78