[PATCH] D125040: [Support] Fix UB in BumpPtrAllocator when first allocation is zero.

Haojian Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 5 22:16:38 PDT 2022


hokein accepted this revision.
hokein added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/include/llvm/Support/Allocator.h:142
   // SpecificBumpPtrAllocator::DestroyAll() loops over all allocations, and
   // that loop is not based on the Allocate() return value.
   LLVM_ATTRIBUTE_RETURNS_NONNULL void *Allocate(size_t Size, Align Alignment) {
----------------
mention this specific behavior of Allocate(0) in the doc: `Allocate(0) returns a non-NULL zero-sized pointer (Dereferencing this pointer is UB).` 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125040/new/

https://reviews.llvm.org/D125040



More information about the llvm-commits mailing list