brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.8 KiB · d2a189f Raw
105 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Exercise CUDA data attribute checks3module m4  type :: t15    integer :: i6  end type7  type :: t28    real, unified :: r(10) ! ok9  end type10  real, constant :: mc ! ok11  real, constant :: mci = 1. ! ok12  !ERROR: Object 'mcl' with ATTRIBUTES(CONSTANT) may not be allocatable, pointer, or target13  real, constant, allocatable :: mcl14  !ERROR: Object 'mcp' with ATTRIBUTES(CONSTANT) may not be allocatable, pointer, or target15  real, constant, pointer :: mcp16  !ERROR: Object 'mct' with ATTRIBUTES(CONSTANT) may not be allocatable, pointer, or target17  real, constant, target :: mct18  real, device :: md ! ok19  real, device :: mdi = 1.20  real, device, allocatable :: mdl ! ok21  real, device, pointer :: mdp ! ok at module level22  real, device, target :: mdt ! ok23  !ERROR: Object 'ms' with ATTRIBUTES(SHARED) must be declared in a device subprogram24  real, shared :: ms25  !ERROR: Object 'msi' with ATTRIBUTES(SHARED) must be declared in a device subprogram26  real, shared :: msi = 1.27  !ERROR: Object 'msl' with ATTRIBUTES(SHARED) may not be allocatable, pointer, or target28  real, shared, allocatable :: msl29  !ERROR: Object 'msp' with ATTRIBUTES(SHARED) may not be allocatable, pointer, or target30  real, shared, pointer :: msp31  !ERROR: Object 'mst' with ATTRIBUTES(SHARED) may not be allocatable, pointer, or target32  real, shared, target :: mst33  !ERROR: Object 'msa' with ATTRIBUTES(SHARED) must be declared in a device subprogram34  real, shared :: msa(*)35  real, managed :: mm ! ok36  real, managed :: mmi = 1. ! ok37  real, managed, allocatable :: mml ! ok38  !ERROR: Object 'mmp' with ATTRIBUTES(MANAGED) must also be allocatable, automatic, explicit shape, or a dummy argument39  real, managed, pointer :: mmp(:)40  real, managed, target :: mmt41  !WARNING: Object 'mp' with ATTRIBUTES(PINNED) should also be allocatable [-Wcuda-usage]42  real, pinned :: mp43  !WARNING: Object 'mpi' with ATTRIBUTES(PINNED) should also be allocatable [-Wcuda-usage]44  real, pinned :: mpi = 1.45  real, pinned, allocatable :: mpl ! ok46  !ERROR: Object 'mpp' with ATTRIBUTES(PINNED) may not be a pointer [-Wcuda-usage]47  real, pinned, pointer :: mpp48  !WARNING: Object 'mpt' with ATTRIBUTES(PINNED) should also be allocatable [-Wcuda-usage]49  real, pinned, target :: mpt ! ok50  !ERROR: ATTRIBUTES(TEXTURE) is obsolete and no longer supported51  real, texture, pointer :: mt52  !ERROR: 'bigint' has intrinsic type 'INTEGER(16)' that is not available on the device53  integer(16), device :: bigint54  !ERROR: Object 'um' with ATTRIBUTES(UNIFIED) must be declared in a host subprogram55  real, unified :: um56 57  type :: t358  !ERROR: Component 'r' with ATTRIBUTES(DEVICE) must also be allocatable or pointer59    real, device :: r60    real, device, pointer :: rp ! ok61    real, device, allocatable :: ra ! ok62    real, device, pointer, contiguous :: rpc ! ok63  end type64 65 contains66  attributes(device) subroutine devsubr(n,da,rs)67    integer, intent(in) :: n68    real, device :: da(*) ! ok69    real, managed :: ma(n) ! ok70    !WARNING: Pointer 'dp' may not be associated in a device subprogram [-Wcuda-usage]71    real, device, pointer :: dp72    real, constant :: rc ! ok73    real, shared :: rs ! ok74    !ERROR: Object 'u' with ATTRIBUTES(UNIFIED) must be declared in a host subprogram75    real, unified :: u76  end subroutine77 78  subroutine host()79    !ERROR: Object 'rc' with ATTRIBUTES(CONSTANT) may not be declared in a host subprogram80    real, constant :: rc81  end subroutine82 83  attributes(global) subroutine devsubr2()84    real, shared :: rs85 86    rs = 1 ! ok87  end subroutine88 89  subroutine host2()90    real, unified :: ru ! ok91    type(t1), unified :: tu ! ok92    type(t2) :: t ! ok93 94    block95      real, device :: a(100) ! ok96    end block97  end subroutine98 99 100end module101 102program p103  real, unified :: um ! ok104end program105