Skip to content

Commit 6732a34

Browse files
committed
[flang][cuda] Do not consider SHARED array as host array
1 parent bbeafe4 commit 6732a34

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

flang/lib/Semantics/check-cuda.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ struct FindHostArray
114114
(details->cudaDataAttr() &&
115115
*details->cudaDataAttr() != common::CUDADataAttr::Device &&
116116
*details->cudaDataAttr() != common::CUDADataAttr::Managed &&
117+
*details->cudaDataAttr() != common::CUDADataAttr::Shared &&
117118
*details->cudaDataAttr() != common::CUDADataAttr::Unified))) {
118119
return &symbol;
119120
}

flang/test/Semantics/cuf09.cuf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ module m
2828
i = threadIdx%x
2929
a(i) = i
3030
end subroutine
31+
32+
attributes(global) subroutine sharedarray(a)
33+
integer, device :: a(10)
34+
integer, shared :: s(10)
35+
i = threadIdx%x
36+
a(i) = s(10) ! ok, a is device and s is shared
37+
end subroutine
3138
end
3239

3340
program main

0 commit comments

Comments
 (0)