diff options
| author | Renato Golin <renato.golin@linaro.org> | 2014-08-27 21:58:56 +0000 |
|---|---|---|
| committer | Renato Golin <renato.golin@linaro.org> | 2014-08-27 21:58:56 +0000 |
| commit | d35213755396ee9b4289510a6e38301de927e66c (patch) | |
| tree | 5554b0026c9657fa6984df998943efdc70733cb7 | |
| parent | 159f127f6306f5d9499a73c391f37013fc3ce29c (diff) | |
| download | bcm5719-llvm-d35213755396ee9b4289510a6e38301de927e66c.tar.gz bcm5719-llvm-d35213755396ee9b4289510a6e38301de927e66c.zip | |
Avoid zero length memset error
Adding a check on buffer lenght to avoid a __warn_memset_zero_len
warning on GCC 4.8.2.
llvm-svn: 216624
| -rw-r--r-- | llvm/include/llvm/Support/Allocator.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/include/llvm/Support/Allocator.h b/llvm/include/llvm/Support/Allocator.h index 5f3b284532d..9ea57039a84 100644 --- a/llvm/include/llvm/Support/Allocator.h +++ b/llvm/include/llvm/Support/Allocator.h @@ -318,8 +318,10 @@ private: #ifndef NDEBUG // Poison the memory so stale pointers crash sooner. Note we must // preserve the Size and NextPtr fields at the beginning. - sys::Memory::setRangeWritable(*I, AllocatedSlabSize); - memset(*I, 0xCD, AllocatedSlabSize); + if (AllocatedSlabSize != 0) { + sys::Memory::setRangeWritable(*I, AllocatedSlabSize); + memset(*I, 0xCD, AllocatedSlabSize); + } #endif Allocator.Deallocate(*I, AllocatedSlabSize); } |

