[clang] [clang][CodeGen] Fix assertion failure for new T[SIZE_MAX] with array cookie (PR #232570)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 16 21:17:53 PDT 2026
================
@@ -1789,8 +1789,10 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const CXXNewExpr *E) {
cleanupDominator = Builder.CreateUnreachable();
}
- assert((allocSize == allocSizeWithoutCookie) ==
- CalculateCookiePadding(*this, E).isZero());
+ // Without a cookie the two sizes must match. With a cookie they usually
+ // differ, but on overflow both can be all-ones, so don't assert the converse.
----------------
henrimarconni wrote:
Good idea, done, keeping the original iff. with an escape hatch just for the edge case where allocSize == all ones value.
https://github.com/llvm/llvm-project/pull/232570
More information about the cfe-commits
mailing list