[llvm-commits] [llvm] r100184 - /llvm/trunk/include/llvm/Support/Allocator.h

Torok Edwin edwintorok at gmail.com
Fri Apr 2 06:20:51 PDT 2010


Author: edwin
Date: Fri Apr  2 08:20:51 2010
New Revision: 100184

URL: http://llvm.org/viewvc/llvm-project?rev=100184&view=rev
Log:
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!

Modified:
    llvm/trunk/include/llvm/Support/Allocator.h

Modified: llvm/trunk/include/llvm/Support/Allocator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Allocator.h?rev=100184&r1=100183&r2=100184&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Allocator.h (original)
+++ llvm/trunk/include/llvm/Support/Allocator.h Fri Apr  2 08:20:51 2010
@@ -200,7 +200,7 @@
     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<T>());
 	if (Ptr + sizeof(T) <= End)
           reinterpret_cast<T*>(Ptr)->~T();





More information about the llvm-commits mailing list