Skip to content

[flang][cuda] Allow PINNED argument to host dummy #90651

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
Apr 30, 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
3 changes: 3 additions & 0 deletions flang/lib/Common/Fortran.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ bool AreCompatibleCUDADataAttrs(std::optional<CUDADataAttr> x,
return true;
} else if (x && y && *x == *y) {
return true;
} else if ((!x && y && *y == CUDADataAttr::Pinned) ||
(x && *x == CUDADataAttr::Pinned && !y)) {
return true;
} else if (ignoreTKR.test(IgnoreTKR::Device) &&
x.value_or(CUDADataAttr::Device) == CUDADataAttr::Device &&
y.value_or(CUDADataAttr::Device) == CUDADataAttr::Device) {
Expand Down
28 changes: 28 additions & 0 deletions flang/test/Semantics/cuf13.cuf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
! RUN: %python %S/test_errors.py %s %flang_fc1

module matching
interface sub
module procedure sub_host
module procedure sub_device
end interface

contains
subroutine sub_host(a)
integer :: a(:)
end

subroutine sub_device(a)
integer, device :: a(:)
end

end module

program m
use matching

integer, pinned, allocatable :: a(:)
logical :: plog
allocate(a(100), pinned = plog)

call sub(a)
end