[compiler-rt] r212071 - Fix apparent thinko in r209744: allocator stats can be zero

Alexey Samsonov vonosmas at gmail.com
Mon Jun 30 15:40:58 PDT 2014


Author: samsonov
Date: Mon Jun 30 17:40:58 2014
New Revision: 212071

URL: http://llvm.org/viewvc/llvm-project?rev=212071&view=rev
Log:
Fix apparent thinko in r209744: allocator stats can be zero

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h?rev=212071&r1=212070&r2=212071&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h Mon Jun 30 17:40:58 2014
@@ -273,9 +273,9 @@ class AllocatorGlobalStats : public Allo
       if (stats == this)
         break;
     }
-    // All stats must be positive.
+    // All stats must be non-negative.
     for (int i = 0; i < AllocatorStatCount; i++)
-      s[i] = ((sptr)s[i]) > 0 ? s[i] : 1;
+      s[i] = ((sptr)s[i]) >= 0 ? s[i] : 0;
   }
 
  private:





More information about the llvm-commits mailing list