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

via flang-commits flang-commits at lists.llvm.org
Sun Jan 4 10:00:28 PST 2026


Author: Valentin Clement (バレンタイン クレメン)
Date: 2026-01-04T18:00:24Z
New Revision: 76b00fc75e942ca1554809288d68f63fac0382eb

URL: https://github.com/llvm/llvm-project/commit/76b00fc75e942ca1554809288d68f63fac0382eb
DIFF: https://github.com/llvm/llvm-project/commit/76b00fc75e942ca1554809288d68f63fac0382eb.diff

LOG: [flang][cuda] Skip sizeof intrinsic in check (#174339)

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

Added: 
    

Modified: 
    flang/lib/Semantics/check-call.cpp
    flang/test/Semantics/cuf23.cuf

Removed: 
    


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