[flang-commits] [flang] 1345ee4 - [flang][cuda] Do not apply implicit data attribute on dummy arg with VALUE (#119927)

via flang-commits flang-commits at lists.llvm.org
Fri Dec 13 14:41:53 PST 2024


Author: Valentin Clement (バレンタイン クレメン)
Date: 2024-12-13T14:41:49-08:00
New Revision: 1345ee4232c90205f152154cfd557c54feb3853d

URL: https://github.com/llvm/llvm-project/commit/1345ee4232c90205f152154cfd557c54feb3853d
DIFF: https://github.com/llvm/llvm-project/commit/1345ee4232c90205f152154cfd557c54feb3853d.diff

LOG: [flang][cuda] Do not apply implicit data attribute on dummy arg with VALUE (#119927)

Dummy arguments with the VALUE attribute do not need the implicit data
attribute.

Added: 
    

Modified: 
    flang/lib/Semantics/resolve-names.cpp
    flang/test/Semantics/modfile55.cuf

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index 6a920cff83b51d..3a1ccec1fdf4bd 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 90c384cbd55b9c..2338b745d8355d 100644
--- a/flang/test/Semantics/modfile55.cuf
+++ b/flang/test/Semantics/modfile55.cuf
@@ -33,7 +33,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


        


More information about the flang-commits mailing list