brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · 5ee61fa Raw
87 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.13 Declare5 6module openacc_declare_validity7 8  implicit none9 10  real(8), dimension(10) :: aa, bb, ab, ac, ad, ae, af, cc, dd11 12  !ERROR: At least one clause is required on the DECLARE directive13  !$acc declare14 15  !$acc declare create(aa, bb)16 17  !WARNING: 'aa' in the CREATE clause is already present in the same clause in this module [-Wopen-acc-usage]18  !$acc declare create(aa)19 20  !$acc declare link(ab)21 22  !$acc declare device_resident(cc)23 24  !ERROR: COPYOUT clause is not allowed on the DECLARE directive in module declaration section25  !$acc declare copyout(ac)26 27  !ERROR: COPY clause is not allowed on the DECLARE directive in module declaration section28  !$acc declare copy(af)29 30  !ERROR: PRESENT clause is not allowed on the DECLARE directive in module declaration section31  !$acc declare present(ad)32 33  !ERROR: DEVICEPTR clause is not allowed on the DECLARE directive in module declaration section34  !$acc declare deviceptr(ae)35 36  !ERROR: The ZERO modifier is not allowed for the CREATE clause on the DECLARE directive37  !$acc declare create(zero: dd)38 39  !ERROR: 'bb' in the COPYIN clause is already present in another CREATE clause in this module40  !$acc declare copyin(bb)41 42contains43 44  subroutine sub1(cc, dd)45    real(8) :: cc(:)46    real(8) :: dd(:)47    !$acc declare present(cc, dd)48    !ERROR: 'cc' in the CREATE clause is already present in another PRESENT clause in this module49    !$acc declare create(cc)50  end subroutine sub151 52  function fct1(ee, ff, gg, hh, ii)53    integer :: fct154    real(8), intent(in) :: ee(:)55    !$acc declare copyin(readonly: ee)56    real(8) :: ff(:), hh(:), ii(:,:)57    !$acc declare link(hh) device_resident(ii)58    real(8), intent(out) :: gg(:)59    !$acc declare copy(ff) copyout(gg)60  end function fct161 62  subroutine sub2(cc)63    real(8), dimension(*) :: cc64    !ERROR: Assumed-size dummy arrays may not appear on the DECLARE directive65    !$acc declare copyin(cc)66  end subroutine sub267 68  subroutine sub2e1(cc)69    real(8), dimension(*) :: cc70    !OK71    !$acc declare present(cc)72  end subroutine sub2e173 74  subroutine sub2e2(cc)75    real(8), dimension(*) :: cc76    !OK77    !$acc declare deviceptr(cc)78  end subroutine sub2e279 80  subroutine sub3()81    real :: aa(100)82    !ERROR: The ZERO modifier is not allowed for the COPYOUT clause on the DECLARE directive83    !$acc declare copyout(zero: aa)84  end subroutine85 86end module openacc_declare_validity87