[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / OpenACC / acc-init-validity.f90
blob278211492c583ee49b06a7f5cf2a099f3ba34682
1 ! RUN: %python %S/../test_errors.py %s %flang -fopenacc
3 ! Check OpenACC clause validity for the following construct and directive:
4 ! 2.14.1 Init
6 program openacc_init_validity
8 implicit none
10 integer :: i, j
11 integer, parameter :: N = 256
12 logical :: ifCondition = .TRUE.
13 real(8), dimension(N) :: a
15 !$acc init
16 !$acc init if(.TRUE.)
17 !$acc init if(ifCondition)
18 !$acc init device_num(1)
19 !$acc init device_num(i)
20 !$acc init device_type(i)
21 !$acc init device_type(2, i, j)
22 !$acc init device_num(i) device_type(i, j) if(ifCondition)
24 !$acc parallel
25 !ERROR: Directive INIT may not be called within a compute region
26 !$acc init
27 !$acc end parallel
29 !$acc serial
30 !ERROR: Directive INIT may not be called within a compute region
31 !$acc init
32 !$acc end serial
34 !$acc kernels
35 !ERROR: Directive INIT may not be called within a compute region
36 !$acc init
37 !$acc end kernels
39 !$acc parallel
40 !$acc loop
41 do i = 1, N
42 !ERROR: Directive INIT may not be called within a compute region
43 !$acc init
44 a(i) = 3.14
45 end do
46 !$acc end parallel
48 !$acc serial
49 !$acc loop
50 do i = 1, N
51 !ERROR: Directive INIT may not be called within a compute region
52 !$acc init
53 a(i) = 3.14
54 end do
55 !$acc end serial
57 !$acc kernels
58 !$acc loop
59 do i = 1, N
60 !ERROR: Directive INIT may not be called within a compute region
61 !$acc init
62 a(i) = 3.14
63 end do
64 !$acc end kernels
66 !$acc parallel loop
67 do i = 1, N
68 !ERROR: Directive INIT may not be called within a compute region
69 !$acc init
70 a(i) = 3.14
71 end do
73 !$acc serial loop
74 do i = 1, N
75 !ERROR: Directive INIT may not be called within a compute region
76 !$acc init
77 a(i) = 3.14
78 end do
80 !$acc kernels loop
81 do i = 1, N
82 !ERROR: Directive INIT may not be called within a compute region
83 !$acc init
84 a(i) = 3.14
85 end do
87 !ERROR: At most one IF clause can appear on the INIT directive
88 !$acc init if(.TRUE.) if(ifCondition)
90 !ERROR: At most one DEVICE_NUM clause can appear on the INIT directive
91 !$acc init device_num(1) device_num(i)
93 !ERROR: At most one DEVICE_TYPE clause can appear on the INIT directive
94 !$acc init device_type(2) device_type(i, j)
96 end program openacc_init_validity