103 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang -fopenacc2 3! Check OpenACC clause validity for the following construct and directive:4! 2.14.1 Init5 6program openacc_init_validity7 8 implicit none9 10 integer :: i, j11 integer, parameter :: N = 25612 logical :: ifCondition = .TRUE.13 integer :: ifInt14 real :: ifReal15 real(8), dimension(N) :: a16 17 !$acc init18 !$acc init if(.TRUE.)19 !$acc init if(ifCondition)20 !$acc init if(ifInt)21 !$acc init device_num(1)22 !$acc init device_num(i)23 !$acc init device_type(default)24 !$acc init device_type(nvidia, radeon)25 !$acc init device_num(i) device_type(host, multicore) if(ifCondition)26 27 !$acc parallel28 !ERROR: Directive INIT may not be called within a compute region29 !$acc init30 !$acc end parallel31 32 !$acc serial33 !ERROR: Directive INIT may not be called within a compute region34 !$acc init35 !$acc end serial36 37 !$acc kernels38 !ERROR: Directive INIT may not be called within a compute region39 !$acc init40 !$acc end kernels41 42 !$acc parallel43 !$acc loop44 do i = 1, N45 !ERROR: Directive INIT may not be called within a compute region46 !$acc init47 a(i) = 3.14d048 end do49 !$acc end parallel50 51 !$acc serial52 !$acc loop53 do i = 1, N54 !ERROR: Directive INIT may not be called within a compute region55 !$acc init56 a(i) = 3.14d057 end do58 !$acc end serial59 60 !$acc kernels61 !$acc loop62 do i = 1, N63 !ERROR: Directive INIT may not be called within a compute region64 !$acc init65 a(i) = 3.14d066 end do67 !$acc end kernels68 69 !$acc parallel loop70 do i = 1, N71 !ERROR: Directive INIT may not be called within a compute region72 !$acc init73 a(i) = 3.14d074 end do75 76 !$acc serial loop77 do i = 1, N78 !ERROR: Directive INIT may not be called within a compute region79 !$acc init80 a(i) = 3.14d081 end do82 83 !$acc kernels loop84 do i = 1, N85 !ERROR: Directive INIT may not be called within a compute region86 !$acc init87 a(i) = 3.14d088 end do89 90 !ERROR: At most one IF clause can appear on the INIT directive91 !$acc init if(.TRUE.) if(ifCondition)92 93 !ERROR: At most one DEVICE_NUM clause can appear on the INIT directive94 !$acc init device_num(1) device_num(i)95 96 ! OK97 !$acc init device_type(nvidia) device_type(default, *)98 99 !ERROR: Must have LOGICAL or INTEGER type100 !$acc init if(ifReal)101 102end program openacc_init_validity103