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

Valentin Clement バレンタイン クレメン via flang-commits flang-commits at lists.llvm.org
Sun Jan 4 09:43:57 PST 2026


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

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

>From c320b7b30d1dec852cf275650b7f772865640a02 Mon Sep 17 00:00:00 2001
From: Valentin Clement <clementval at gmail.com>
Date: Sun, 4 Jan 2026 09:42:27 -0800
Subject: [PATCH] [flang][cuda] Skip sizeof intrinsic in check

---
 flang/lib/Semantics/check-call.cpp | 2 +-
 flang/test/Semantics/cuf23.cuf     | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

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



More information about the flang-commits mailing list