[flang-commits] [flang] [flang][cuda] Do not apply implicit data attribute on dummy arg with VALUE (PR #119927)
via flang-commits
flang-commits at lists.llvm.org
Fri Dec 13 13:13:31 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-semantics
Author: Valentin Clement (バレンタイン クレメン) (clementval)
<details>
<summary>Changes</summary>
Dummy arguments with the VALUE attribute do not need the implicit data attribute.
---
Full diff: https://github.com/llvm/llvm-project/pull/119927.diff
2 Files Affected:
- (modified) flang/lib/Semantics/resolve-names.cpp (+1-1)
- (modified) flang/test/Semantics/modfile55.cuf (-1)
``````````diff
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index aef2898919f3ff..313508eb423138 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -8976,7 +8976,7 @@ void ResolveNamesVisitor::FinishSpecificationPart(
if (inDeviceSubprogram && IsDummy(symbol) &&
symbol.has<ObjectEntityDetails>()) {
auto *dummy{symbol.detailsIf<ObjectEntityDetails>()};
- if (!dummy->cudaDataAttr()) {
+ if (!dummy->cudaDataAttr() && !IsValue(symbol)) {
// Implicitly set device attribute if none is set in device context.
dummy->set_cudaDataAttr(common::CUDADataAttr::Device);
}
diff --git a/flang/test/Semantics/modfile55.cuf b/flang/test/Semantics/modfile55.cuf
index 6c0d152a382a88..cf01bdd5f58f6f 100644
--- a/flang/test/Semantics/modfile55.cuf
+++ b/flang/test/Semantics/modfile55.cuf
@@ -29,7 +29,6 @@ end
!contains
!attributes(global) subroutine globsub(x,y,z)
!real(4),value::x
-!attributes(device) x
!real(4)::y
!attributes(device) y
!real(4)::z
``````````
</details>
https://github.com/llvm/llvm-project/pull/119927
More information about the flang-commits
mailing list