[clang] 8d8a196 - [clang][bytecode] Check CarrayOutPtr in subcl more thorougly (#203172)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 10 22:53:23 PDT 2026
Author: Timm Baeder
Date: 2026-06-11T07:53:17+02:00
New Revision: 8d8a19649168b9fd6e8ec4b6eaee47506c5ec38f
URL: https://github.com/llvm/llvm-project/commit/8d8a19649168b9fd6e8ec4b6eaee47506c5ec38f
DIFF: https://github.com/llvm/llvm-project/commit/8d8a19649168b9fd6e8ec4b6eaee47506c5ec38f.diff
LOG: [clang][bytecode] Check CarrayOutPtr in subcl more thorougly (#203172)
Use the local `isReadable` check.
Added:
Modified:
clang/lib/AST/ByteCode/InterpBuiltin.cpp
clang/test/AST/ByteCode/builtins.c
Removed:
################################################################################
diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index 08fc8252d0708..4326142aba81f 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -984,7 +984,7 @@ static bool interp__builtin_carryop(InterpState &S, CodePtr OpPC,
if (!popToAPSInt(S.Stk, LHST, LHS))
return false;
- if (CarryOutPtr.isDummy() || !CarryOutPtr.isBlockPointer())
+ if (!isReadable(CarryOutPtr))
return false;
APSInt CarryOut;
diff --git a/clang/test/AST/ByteCode/builtins.c b/clang/test/AST/ByteCode/builtins.c
index dc19d197d0a2e..8af1c5cc90616 100644
--- a/clang/test/AST/ByteCode/builtins.c
+++ b/clang/test/AST/ByteCode/builtins.c
@@ -37,3 +37,7 @@ const int compared = strcmp(_str, (const char *)_str2); // both-error {{initiali
int ptrint = __builtin_bswap64("") == 0x1234 ? 1 : 0; // both-error {{incompatible pointer to integer conversion}} \
// both-error {{initializer element is not a compile-time constant}}
+
+void subclNonReadable() {
+ if(__builtin_subcl(0, 0, 0, &(*({ struct {} x; &x; }))) != 0) {} // both-error {{incompatible pointer types}}
+}
More information about the cfe-commits
mailing list