Skip to content

[flang][cuda] Do not emit warning for SHARED variable in device subprogram #115195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion flang/lib/Semantics/check-declarations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,9 @@ void CheckHelper::CheckObjectEntity(
details.cudaDataAttr().value_or(common::CUDADataAttr::Device) !=
common::CUDADataAttr::Device &&
details.cudaDataAttr().value_or(common::CUDADataAttr::Device) !=
common::CUDADataAttr::Managed) {
common::CUDADataAttr::Managed &&
details.cudaDataAttr().value_or(common::CUDADataAttr::Device) !=
common::CUDADataAttr::Shared) {
Warn(common::UsageWarning::CUDAUsage,
"Dummy argument '%s' may not have ATTRIBUTES(%s) in a device subprogram"_warn_en_US,
symbol.name(),
Expand Down
3 changes: 2 additions & 1 deletion flang/test/Semantics/cuf03.cuf
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,14 @@ module m
real, unified :: um

contains
attributes(device) subroutine devsubr(n,da)
attributes(device) subroutine devsubr(n,da,rs)
integer, intent(in) :: n
real, device :: da(*) ! ok
real, managed :: ma(n) ! ok
!WARNING: Pointer 'dp' may not be associated in a device subprogram
real, device, pointer :: dp
real, constant :: rc ! ok
real, shared :: rs ! ok
!ERROR: Object 'u' with ATTRIBUTES(UNIFIED) must be declared in a host subprogram
real, unified :: u
end subroutine
Expand Down
Loading