[clang] [clang][bytecode] Check builtin carryops for non-block out pointers (PR #165512)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 28 22:48:04 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
Fixes https://github.com/llvm/llvm-project/issues/165372
---
Full diff: https://github.com/llvm/llvm-project/pull/165512.diff
2 Files Affected:
- (modified) clang/lib/AST/ByteCode/InterpBuiltin.cpp (+1-1)
- (modified) clang/test/AST/ByteCode/builtin-functions.cpp (+2-1)
``````````diff
diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index ab6b3ed1be0aa..b3ab82da5e01a 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -859,7 +859,7 @@ static bool interp__builtin_carryop(InterpState &S, CodePtr OpPC,
APSInt RHS = popToAPSInt(S.Stk, RHST);
APSInt LHS = popToAPSInt(S.Stk, LHST);
- if (CarryOutPtr.isDummy())
+ if (CarryOutPtr.isDummy() || !CarryOutPtr.isBlockPointer())
return false;
APSInt CarryOut;
diff --git a/clang/test/AST/ByteCode/builtin-functions.cpp b/clang/test/AST/ByteCode/builtin-functions.cpp
index e9093b2f23f74..a90f636b5134b 100644
--- a/clang/test/AST/ByteCode/builtin-functions.cpp
+++ b/clang/test/AST/ByteCode/builtin-functions.cpp
@@ -1856,7 +1856,8 @@ namespace InitParam {
#endif
-namespace SAddOverflowInt {
+namespace NonBlockPointerStore {
int a;
void foo(void) { a *= __builtin_sadd_overflow(1, 2, 0); }
+ void foo2(void) { a *= __builtin_addc(1, 2, 0, 0); }
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/165512
More information about the cfe-commits
mailing list