From: Torok Edwin Date: Fri, 2 Apr 2010 13:20:51 +0000 (+0000) Subject: Fix SpecificBumpPtrAllocator iteration. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=86bfd34ece523d863282ef2a2e4cf451c387c559;ds=sidebyside Fix SpecificBumpPtrAllocator iteration. Need to start from (char*)(Slab+1), and not from (char*)Slab+1. This fixes crashes in Win64 debug mode. Thanks to Nicolas Capens! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100184 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Support/Allocator.h b/include/llvm/Support/Allocator.h index bd381807e0c..eb6c2d1e25a 100644 --- a/include/llvm/Support/Allocator.h +++ b/include/llvm/Support/Allocator.h @@ -200,7 +200,7 @@ public: while (Slab) { char *End = Slab == Allocator.CurSlab ? Allocator.CurPtr : (char *)Slab + Slab->Size; - for (char *Ptr = (char*)Slab+1; Ptr < End; Ptr += sizeof(T)) { + for (char *Ptr = (char*)(Slab+1); Ptr < End; Ptr += sizeof(T)) { Ptr = Allocator.AlignPtr(Ptr, alignof()); if (Ptr + sizeof(T) <= End) reinterpret_cast(Ptr)->~T();