mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 04:06:46 +00:00

Extend the definability and procedure characteristics checking infrastructure in semantics to check for context-dependent CUDA object definability violations and problems with CUDA attribute incompatibility in procedure interfaces. Depends on https://reviews.llvm.org/D150159, https://reviews.llvm.org/D150161, & https://reviews.llvm.org/D150162. Differential Revision: https://reviews.llvm.org/D150163
32 lines
1.2 KiB
Plaintext
32 lines
1.2 KiB
Plaintext
! RUN: %python %S/test_errors.py %s %flang_fc1
|
|
module m
|
|
real, constant :: rc
|
|
!ERROR: Object 'rcp' with ATTRIBUTES(CONSTANT) may not be allocatable, pointer, or target
|
|
real, constant, pointer :: rcp
|
|
!ERROR: Object 'rct' with ATTRIBUTES(CONSTANT) may not be allocatable, pointer, or target
|
|
real, constant, target :: rct
|
|
real, device, pointer :: dp(:)
|
|
real, device, target :: dt(100)
|
|
contains
|
|
attributes(device) subroutine devsub
|
|
!ERROR: Left-hand side of assignment is not definable
|
|
!BECAUSE: 'rc' has ATTRIBUTES(CONSTANT) and is not definable in a device subprogram
|
|
rc = 1.
|
|
!ERROR: The left-hand side of a pointer assignment is not definable
|
|
!BECAUSE: 'dp' is a pointer and may not be associated in a device subprogram
|
|
dp => dt
|
|
end
|
|
attributes(global) subroutine globsub
|
|
!ERROR: Left-hand side of assignment is not definable
|
|
!BECAUSE: 'rc' has ATTRIBUTES(CONSTANT) and is not definable in a device subprogram
|
|
rc = 1.
|
|
!ERROR: The left-hand side of a pointer assignment is not definable
|
|
!BECAUSE: 'dp' is a pointer and may not be associated in a device subprogram
|
|
dp => dt
|
|
end
|
|
subroutine hostsub
|
|
rc = 1.
|
|
dp => dt
|
|
end
|
|
end
|