aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/InterpBuiltin.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-07-06 16:42:06 +0200
committerGitHub <noreply@github.com>2025-07-06 16:42:06 +0200
commitec9eefcef560e4ea5b5d8ee6ed9cc6ef8c1f274c (patch)
tree8b2f61b6a1ae6efaaccc92c020f52961d9883b03 /clang/lib/AST/ByteCode/InterpBuiltin.cpp
parentdb4e927f9f02b40a0bc332205b88bc40edc29afc (diff)
downloadllvm-ec9eefcef560e4ea5b5d8ee6ed9cc6ef8c1f274c.zip
llvm-ec9eefcef560e4ea5b5d8ee6ed9cc6ef8c1f274c.tar.gz
llvm-ec9eefcef560e4ea5b5d8ee6ed9cc6ef8c1f274c.tar.bz2
[clang][bytecode] Fix a crash in overflow builtins (#147189)
Only initialize pointers that can be initialized.
Diffstat (limited to 'clang/lib/AST/ByteCode/InterpBuiltin.cpp')
-rw-r--r--clang/lib/AST/ByteCode/InterpBuiltin.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index 1d6f444..db18ad2 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -861,7 +861,9 @@ static bool interp__builtin_overflowop(InterpState &S, CodePtr OpPC,
// Write Result to ResultPtr and put Overflow on the stack.
assignInteger(S, ResultPtr, ResultT, Result);
- ResultPtr.initialize();
+ if (ResultPtr.canBeInitialized())
+ ResultPtr.initialize();
+
assert(Call->getDirectCallee()->getReturnType()->isBooleanType());
S.Stk.push<Boolean>(Overflow);
return true;