Boost C++ Libraries: Ticket #5065: Valgrind complaint when using Boost MPI https://svn.boost.org/trac10/ticket/5065 <p> I am using the latest Boost library (version 1.45.0) on Ubuntu. I have built Boost from the source using the bjam. </p> <p> boost::mpi::all_reduce uses boost::mpi::broadcast which seems to generate annoying invalid write errors under valgrind. The problem points to the line 47 in boost/mpi/detail/packed_oprimitive.hpp in const std::size_t &amp;size() const function. I changed the function to: </p> <blockquote> <p> const std::size_t&amp; size() const { </p> <blockquote> <p> const_cast&lt;std::size_t &amp;&gt;(size_) = buffer_.size(); return size_; </p> </blockquote> <p> } </p> </blockquote> <p> and the valgrind complaint seems to be gone. Const_cast seems less than ideal, but it fixes the problem. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5065 Trac 1.4.3 dongryel@… Thu, 13 Jan 2011 03:05:52 GMT <link>https://svn.boost.org/trac10/ticket/5065#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5065#comment:1</guid> <description> <p> Actually, this does not solve the problem. I did not notice that the mutable keyword was already present for size_ member. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Matthias Troyer</dc:creator> <pubDate>Tue, 01 Jan 2013 11:12:48 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5065#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5065#comment:2</guid> <description> <p> Is this still present? If so, do you have a test case that we can try to reproduce? </p> </description> <category>Ticket</category> </item> </channel> </rss>