brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · cf82a85 Raw
46 lines · plain
1! OpenMP offloading test that checks we do not cause a segfault when mapping2! optional function arguments (present or otherwise). No results requiring3! checking other than that the program compiles and runs to completion with no4! error. This particular variation checks that we're correctly emitting the5! load/store in both branches mapping the input array.6! REQUIRES: flang, amdgpu7 8! RUN: %libomptarget-compile-fortran-run-and-check-generic9module reproducer_mod10contains11   subroutine branching_target_call(dt, switch)12      implicit none13      real(4), dimension(:), intent(inout) :: dt14      logical, intent(in) :: switch15      integer :: dim, idx16 17      dim = size(dt)18      if (switch) then19!$omp target teams distribute parallel do20         do idx = 1, dim21            dt(idx) = 2022         end do23      else24!$omp target teams distribute parallel do25         do idx = 1, dim26            dt(idx) = 3027         end do28      end if29   end subroutine branching_target_call30end module reproducer_mod31 32program reproducer33   use reproducer_mod34   implicit none35   real(4), dimension(:), allocatable :: dt36   integer :: n = 2131237   integer :: i38 39   allocate (dt(n))40   call branching_target_call(dt, .FALSE.)41   call branching_target_call(dt, .TRUE.)42   print *, "PASSED"43end program reproducer44 45! CHECK: PASSED46