Skip to content

Commit 8582d5a

Browse files
committed
Implicitly set device attribute for variables that have VALUE attribute inside device routines
1 parent 3e6a704 commit 8582d5a

File tree

5 files changed

+43403
-2
lines changed

5 files changed

+43403
-2
lines changed

flang/lib/Semantics/resolve-names.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9561,8 +9561,7 @@ void ResolveNamesVisitor::CreateGeneric(const parser::GenericSpec &x) {
95619561
static void SetImplicitCUDADevice(bool inDeviceSubprogram, Symbol &symbol) {
95629562
if (inDeviceSubprogram && symbol.has<ObjectEntityDetails>()) {
95639563
auto *object{symbol.detailsIf<ObjectEntityDetails>()};
9564-
if (!object->cudaDataAttr() && !IsValue(symbol) &&
9565-
!IsFunctionResult(symbol)) {
9564+
if (!object->cudaDataAttr() && !IsFunctionResult(symbol)) {
95669565
// Implicitly set device attribute if none is set in device context.
95679566
object->set_cudaDataAttr(common::CUDADataAttr::Device);
95689567
}

flang/test/Lower/CUDA/a.out

3.29 MB
Binary file not shown.

flang/test/Lower/CUDA/char1.mod

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
!mod$ v1 sum:dcc937f37583c496
2+
module char1
3+
character(1_8,1),allocatable::da(:)
4+
attributes(device) da
5+
character(1_8,1),allocatable::db(:)
6+
attributes(device) db
7+
contains
8+
attributes(device) function check_char(c1,c2)
9+
character(1_8,1),value::c1
10+
character(1_8,1),value::c2
11+
logical(4)::check_char
12+
end
13+
end

0 commit comments

Comments
 (0)