Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Dec 13, 2024

Conversation

clementval
Copy link
Contributor

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

@llvmbot llvmbot added flang Flang issues not falling into any other category flang:semantics labels Dec 13, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 13, 2024

@llvm/pr-subscribers-flang-semantics

Author: Valentin Clement (バレンタイン クレメン) (clementval)

Changes

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 --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

@clementval clementval merged commit 1345ee4 into llvm:main Dec 13, 2024
11 checks passed
@clementval clementval deleted the cuf_implicit_value branch December 13, 2024 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:semantics flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants