brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.0 KiB · 0b74e34 Raw
134 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=512 3subroutine defaultmap_all_none_no_errors4    implicit none5    real :: array(10)6    integer,  pointer :: ptr(:)7    real, allocatable :: alloca8    integer :: index9 10    !$omp target defaultmap(none) map(to: index, alloca) map(tofrom: array, ptr)11        do index = 1, 1012            ptr(index) = array(index) + alloca13        end do14    !$omp end target15end subroutine defaultmap_all_none_no_errors16 17subroutine defaultmap_all_none18    implicit none19    real :: array(10)20    integer,  pointer :: ptr(:)21    real, allocatable :: alloca22    integer :: index23    !$omp target defaultmap(none)24!ERROR: The DEFAULTMAP(NONE) clause requires that 'index' must be listed in a data-sharing attribute, data-mapping attribute, or is_device_ptr clause25        do index = 1, 1026!ERROR: The DEFAULTMAP(NONE) clause requires that 'ptr' must be listed in a data-sharing attribute, data-mapping attribute, or is_device_ptr clause27!ERROR: The DEFAULTMAP(NONE) clause requires that 'index' must be listed in a data-sharing attribute, data-mapping attribute, or is_device_ptr clause28!ERROR: The DEFAULTMAP(NONE) clause requires that 'array' must be listed in a data-sharing attribute, data-mapping attribute, or is_device_ptr clause29!ERROR: The DEFAULTMAP(NONE) clause requires that 'index' must be listed in a data-sharing attribute, data-mapping attribute, or is_device_ptr clause30!ERROR: The DEFAULTMAP(NONE) clause requires that 'alloca' must be listed in a data-sharing attribute, data-mapping attribute, or is_device_ptr clause31            ptr(index) = array(index) + alloca32        end do33    !$omp end target34end subroutine defaultmap_all_none35 36subroutine defaultmap_scalar_none37    implicit none38    real :: array(10)39    integer,  pointer :: ptr(:)40    real, allocatable :: alloca41    integer :: index42 43    !$omp target defaultmap(none: scalar)44!ERROR: The DEFAULTMAP(NONE) clause requires that 'index' must be listed in a data-sharing attribute, data-mapping attribute, or is_device_ptr clause45        do index = 1, 1046!ERROR: The DEFAULTMAP(NONE) clause requires that 'index' must be listed in a data-sharing attribute, data-mapping attribute, or is_device_ptr clause47!ERROR: The DEFAULTMAP(NONE) clause requires that 'index' must be listed in a data-sharing attribute, data-mapping attribute, or is_device_ptr clause48            ptr(index) = array(index) + alloca49        end do50    !$omp end target51end subroutine defaultmap_scalar_none52 53subroutine defaultmap_pointer_none54    implicit none55    real :: array(10)56    integer,  pointer :: ptr(:)57    real, allocatable :: alloca58    integer :: index59 60    !$omp target defaultmap(none: pointer)61        do index = 1, 1062!ERROR: The DEFAULTMAP(NONE) clause requires that 'ptr' must be listed in a data-sharing attribute, data-mapping attribute, or is_device_ptr clause63            ptr(index) = array(index) + alloca64        end do65    !$omp end target66end subroutine defaultmap_pointer_none67 68subroutine defaultmap_allocatable_none69    implicit none70    real :: array(10)71    integer,  pointer :: ptr(:)72    real, allocatable :: alloca73    integer :: index74 75    !$omp target defaultmap(none: allocatable)76        do index = 1, 1077!ERROR: The DEFAULTMAP(NONE) clause requires that 'alloca' must be listed in a data-sharing attribute, data-mapping attribute, or is_device_ptr clause78            ptr(index) = array(index) + alloca79        end do80    !$omp end target81end subroutine defaultmap_allocatable_none82 83subroutine defaultmap_aggregate_none84    implicit none85    real :: array(10)86    integer,  pointer :: ptr(:)87    real, allocatable :: alloca88    integer :: index89 90    !$omp target defaultmap(none: aggregate)91        do index = 1, 1092!ERROR: The DEFAULTMAP(NONE) clause requires that 'array' must be listed in a data-sharing attribute, data-mapping attribute, or is_device_ptr clause93            ptr(index) = array(index) + alloca94        end do95    !$omp end target96end subroutine defaultmap_aggregate_none97 98! Verify we do not catch null in defaultmap(none)99subroutine defaultmap_builtin_none100    implicit none101    integer,  pointer :: ptr(:)102 103    !$omp target defaultmap(none) map(ptr)104!CHECK-NOT: The DEFAULTMAP(NONE) clause requires that 'null' must be listed in a data-sharing attribute, data-mapping attribute, or is_device_ptr clause105            ptr => null()106    !$omp end target107end subroutine defaultmap_builtin_none108 109module pro110 implicit none111contains112 113 function test_procedure() result(ret)114    integer :: ret115    ret = 1116 end function test_procedure117 118! Verify we do not catch a function symbol in defaultmap(none)119! but do catch procedure pointers120subroutine defaultmap_func_and_procedure_pointer()121    implicit none122    procedure(test_procedure), pointer :: f1123    integer :: i124 125    f1 => test_procedure126 127    !$omp target defaultmap(none) map(i)128!ERROR: The DEFAULTMAP(NONE) clause requires that 'f1' must be listed in a data-sharing attribute, data-mapping attribute, or is_device_ptr clause129        i = f1()130        i = test_procedure()131    !$omp end target132end subroutine defaultmap_func_and_procedure_pointer133end module134