42 lines · plain
1!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s2!RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-is-device %s -o - | FileCheck %s3 4! This test is a reduced version of the example in issue 63362.5! It aims to test that no crash occurs when declare target is6! utilised within an unnamed main program and that we still7! appropriately mark the function as declare target, even when8! unused within the target region.9 10!CHECK: func.func @_QPfoo(%{{.*}}: !fir.ref<f32>{{.*}}) -> f32 attributes {{{.*}}omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), automap = false>{{.*}}}11 12interface13real function foo (x)14 !$omp declare target15 real, intent(in) :: x16end function foo17end interface18integer, parameter :: n = 100019integer, parameter :: c = 10020integer :: i, j21real :: a(n)22do i = 1, n23a(i) = i24end do25do i = 1, n, c26 !$omp target map(a(i:i+c-1))27 !$omp parallel do28 do j = i, i + c - 129 a(j) = a(j)30 end do31 !$omp end target32end do33do i = 1, n34if (a(i) /= i + 1) stop 135end do36end37real function foo (x)38!$omp declare target39real, intent(in) :: x40foo = x + 141end function foo42