From b7ed5c8e06221d66ee69036e24a079ee3f528a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Clement=20=28=E3=83=90=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=B3=20=E3=82=AF=E3=83=AC=E3=83=A1?= =?UTF-8?q?=E3=83=B3=29?= Date: Tue, 18 Mar 2025 15:39:04 -0700 Subject: [PATCH] [flang][cuda] Check for ignore_tkr(d) when resolving generic call (#131923) --- flang/lib/Support/Fortran.cpp | 3 +++ flang/test/Semantics/cuf13.cuf | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/flang/lib/Support/Fortran.cpp b/flang/lib/Support/Fortran.cpp index 746b7c974072..f91c72d96fc9 100644 --- a/flang/lib/Support/Fortran.cpp +++ b/flang/lib/Support/Fortran.cpp @@ -111,6 +111,9 @@ bool AreCompatibleCUDADataAttrs(std::optional 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 dafcffa5e93b..ab8e60cabdf5 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