Skip to content

Conversation

@clementval
Copy link
Contributor

No description provided.

@clementval clementval requested a review from wangzpgi March 18, 2025 21:53
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:semantics labels Mar 18, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 18, 2025

@llvm/pr-subscribers-flang-semantics

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

Changes

Full diff: https://github.com/llvm/llvm-project/pull/131923.diff

2 Files Affected:

  • (modified) flang/lib/Support/Fortran.cpp (+3)
  • (modified) flang/test/Semantics/cuf13.cuf (+9)
diff --git a/flang/lib/Support/Fortran.cpp b/flang/lib/Support/Fortran.cpp
index 746b7c9740728..f91c72d96fc97 100644
--- a/flang/lib/Support/Fortran.cpp
+++ b/flang/lib/Support/Fortran.cpp
@@ -111,6 +111,9 @@ bool AreCompatibleCUDADataAttrs(std::optional<CUDADataAttr> x,
   bool isCudaUnified{features
           ? features->IsEnabled(common::LanguageFeature::CudaUnified)
           : false};
+  if (ignoreTKR.test(common::IgnoreTKR::Device)) {
+    return true;
+  }
   if (!x && !y) {
     return true;
   } else if (x && y && *x == *y) {
diff --git a/flang/test/Semantics/cuf13.cuf b/flang/test/Semantics/cuf13.cuf
index dafcffa5e93bd..ab8e60cabdf5e 100644
--- a/flang/test/Semantics/cuf13.cuf
+++ b/flang/test/Semantics/cuf13.cuf
@@ -8,6 +8,13 @@ module matching
     module procedure sub_unified
   end interface
 
+  interface
+  subroutine ignore(a)
+    !dir$ ignore_tkr(d) a
+    integer, managed :: a(:)
+  end subroutine
+  end interface
+
 contains
   subroutine sub_host(a)
     integer :: a(:)
@@ -43,9 +50,11 @@ program m
   call sub(u) ! Should resolve to sub_unified
   call sub(d) ! Should resolve to sub_device
 
+  call ignore(a)
 end
 
 ! CHECK: CALL sub_host
 ! CHECK: CALL sub_managed
 ! CHECK: CALL sub_unified
 ! CHECK: CALL sub_device
+! CHECK: CALL ignore

@clementval clementval merged commit b7ed5c8 into llvm:main Mar 18, 2025
10 of 13 checks passed
@clementval clementval deleted the cuf_ignore_tkr branch March 18, 2025 22:39
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