[clang] [clang][bytecode] Fix stack corruption in builtin delete handler (PR #195741)
via cfe-commits
cfe-commits at lists.llvm.org
Mon May 4 23:54:37 PDT 2026
================
@@ -1633,6 +1633,18 @@ static bool interp__builtin_operator_delete(InterpState &S, CodePtr OpPC,
const Expr *Source = nullptr;
const Block *BlockToDelete = nullptr;
+ assert(Call->getNumArgs() >= 1);
+ unsigned NumArgs = Call->getNumArgs();
+
+ // The std::nothrow_t argument never put on the stack.
+ if (Call->getArg(NumArgs - 1)->getType()->isNothrowT())
+ --NumArgs;
----------------
cakgok wrote:
Ok, I blindly copied it from operator_new but that was wrong.
delete does put all arguments to the stack so it should be popped.
If clause is now removed.
https://github.com/llvm/llvm-project/pull/195741
More information about the cfe-commits
mailing list