[clang] [clang][bytecode] Check builtin carryops for non-block out pointers (PR #165512)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 28 22:47:29 PDT 2025
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/165512
Fixes https://github.com/llvm/llvm-project/issues/165372
>From 1d9f5cc3eb936e92c766f3b2885097ee1dbab9a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Wed, 29 Oct 2025 06:46:21 +0100
Subject: [PATCH] [clang][bytecode] Check builtin carryops for non-block out
pointers
Fixes https://github.com/llvm/llvm-project/issues/165372
---
clang/lib/AST/ByteCode/InterpBuiltin.cpp | 2 +-
clang/test/AST/ByteCode/builtin-functions.cpp | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
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); }
}
More information about the cfe-commits
mailing list