Hi all.

Pool allocators use valgrind API to mark freed memory blocks as unaccessible.
Shared memory block pool needs to make them accessible again before returning to
other pools (otherwise valgrind will cry wolf).

I checked that build passes without valgrind checks and starts fine (i.e. errors
disappear during RT libraries build) with valgrind checks on x86_64-linux.
Markus also helped with valgrind test on ppc64le-linux.

Committed as obvious, r228033.

2015-09-23  Mikhail Maltsev  <malts...@gmail.com>

        PR middle-end/67649
        * memory-block.h (memory_block_pool::allocate): Use valgrind API to
        mark the block as accessible.
-- 
Regards,
    Mikhail Maltsev

diff --git a/gcc/memory-block.h b/gcc/memory-block.h
index 1a495ea..8b1202b 100644
--- a/gcc/memory-block.h
+++ b/gcc/memory-block.h
@@ -57,6 +57,7 @@ memory_block_pool::allocate ()

   void *result = instance.m_blocks;
   instance.m_blocks = instance.m_blocks->m_next;
+  VALGRIND_DISCARD (VALGRIND_MAKE_MEM_UNDEFINED (result, block_size));
   return result;
 }

Reply via email to