[flang-commits] [flang] [flang][cuda] Skip sizeof intrinsic in check (PR #174339)

via flang-commits flang-commits at lists.llvm.org
Sun Jan 4 09:44:31 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-semantics

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

<details>
<summary>Changes</summary>

#<!-- -->174025 introduced a new semantic check for host intrinsic with device variable.`sizeof` intrinsic extension should be skipped for this check. 

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


2 Files Affected:

- (modified) flang/lib/Semantics/check-call.cpp (+1-1) 
- (modified) flang/test/Semantics/cuf23.cuf (+1) 


``````````diff
diff --git a/flang/lib/Semantics/check-call.cpp b/flang/lib/Semantics/check-call.cpp
index 0cccd32acba3d..58b8c248147e4 100644
--- a/flang/lib/Semantics/check-call.cpp
+++ b/flang/lib/Semantics/check-call.cpp
@@ -342,7 +342,7 @@ static bool DefersSameTypeParameters(
 // arguments.
 static const llvm::StringSet<> cudaSkippedIntrinsics = {"__builtin_c_devloc",
     "__builtin_c_f_pointer", "__builtin_c_loc", "allocated", "associated",
-    "kind", "lbound", "loc", "present", "shape", "size", "ubound"};
+    "kind", "lbound", "loc", "present", "shape", "size", "sizeof", "ubound"};
 
 static void CheckExplicitDataArg(const characteristics::DummyDataObject &dummy,
     const std::string &dummyName, evaluate::Expr<evaluate::SomeType> &actual,
diff --git a/flang/test/Semantics/cuf23.cuf b/flang/test/Semantics/cuf23.cuf
index 2d7b70c021d0c..5c3c5c0209233 100644
--- a/flang/test/Semantics/cuf23.cuf
+++ b/flang/test/Semantics/cuf23.cuf
@@ -75,4 +75,5 @@ subroutine intrinsic_error_size(n)
   integer :: n, x
   real(8), device :: d(n,n)
   x = size(d,dim=1) ! ok
+  x = sizeof(d) ! ok
 end subroutine

``````````

</details>


https://github.com/llvm/llvm-project/pull/174339


More information about the flang-commits mailing list