Boost C++ Libraries: Ticket #11412: reserve() : null pointer passed to memmove https://svn.boost.org/trac10/ticket/11412 <p> The following error is reported </p> <pre class="wiki">boost/container/detail/copy_move_algo.hpp:199:4: runtime error: null pointer passed as argument 2, which is declared to never be null </pre><p> when compiling the following example with GCC 5 with the <code>-fsanitize=undefined</code> option </p> <pre class="wiki">#include &lt;boost/container/flat_set.hpp&gt; int main () { boost::container::flat_set&lt;unsigned int&gt; fs; fs.reserve(10); return 0; } </pre><p> Indeed, when putting a breakpoint at the reported line, the <code>f</code> argument is null. </p> <pre class="wiki">std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n); </pre><p> However, valgrind does not report anything and calling <code>capacity()</code> reports the correct size. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11412 Trac 1.4.3 Ion Gaztañaga Thu, 02 Jul 2015 11:55:09 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/11412#comment:1 https://svn.boost.org/trac10/ticket/11412#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Thanks for the report fixed in: </p> <p> [develop a7f60c1] Fix for Trac <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/11412" title="#11412: Bugs: reserve() : null pointer passed to memmove (closed: fixed)">#11412</a> ("reserve() : null pointer passed to memmove") </p> <p> <a class="ext-link" href="https://github.com/boostorg/container/commit/a7f60c1e8c02d2590d01474cde9be69c9114db28"><span class="icon">​</span>https://github.com/boostorg/container/commit/a7f60c1e8c02d2590d01474cde9be69c9114db28</a> </p> Ticket