[flang][cuda] Do not consider SHARED array as host array (#120306)
Update the current `FindHostArray` to not return shared array as host
array.
diff --git a/flang/lib/Semantics/check-cuda.cpp b/flang/lib/Semantics/check-cuda.cpp
index d8c9db2..15ee5f3 100644
--- a/flang/lib/Semantics/check-cuda.cpp
+++ b/flang/lib/Semantics/check-cuda.cpp
@@ -115,6 +115,7 @@
(details->cudaDataAttr() &&
*details->cudaDataAttr() != common::CUDADataAttr::Device &&
*details->cudaDataAttr() != common::CUDADataAttr::Managed &&
+ *details->cudaDataAttr() != common::CUDADataAttr::Shared &&
*details->cudaDataAttr() != common::CUDADataAttr::Unified))) {
return &symbol;
}
diff --git a/flang/test/Semantics/cuf09.cuf b/flang/test/Semantics/cuf09.cuf
index e2247da..7452ee7 100644
--- a/flang/test/Semantics/cuf09.cuf
+++ b/flang/test/Semantics/cuf09.cuf
@@ -35,6 +35,13 @@
i = threadIdx%x
a(i) = i
end subroutine
+
+ attributes(global) subroutine sharedarray(a)
+ integer, device :: a(10)
+ integer, shared :: s(10)
+ i = threadIdx%x
+ a(i) = s(10) ! ok, a is device and s is shared
+ end subroutine
end
program main