Boost C++ Libraries: Ticket #3869: Unconditional call to memset in value_initialized() https://svn.boost.org/trac10/ticket/3869 <p> The call is there to workaround bugs in a few specific compilers, but is applied unconditionally, cannot be optimized away, and thus significantly limits applicability of the component in a library context. </p> <p> See <a class="ext-link" href="http://old.nabble.com/boost::mpl::for_each-and-value_initialized-td25246848.html"><span class="icon">​</span>http://old.nabble.com/boost::mpl::for_each-and-value_initialized-td25246848.html</a> for the full discussion. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3869 Trac 1.4.3 niels_dekker Thu, 28 Jan 2010 14:49:39 GMT attachment set https://svn.boost.org/trac10/ticket/3869 https://svn.boost.org/trac10/ticket/3869 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">config_compiler.patch</span> </li> </ul> <p> Adds BOOST_VALUE_INITIALIZATION_NEEDS_MEMSET to trunk/boost/config/compiler </p> Ticket niels_dekker Thu, 28 Jan 2010 14:53:04 GMT <link>https://svn.boost.org/trac10/ticket/3869#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3869#comment:1</guid> <description> <p> Fernando (the author of value_init) mailed me that it's okay to him if I add an #ifdef to utility/value_init.hpp: </p> <pre class="wiki"> #ifdef BOOST_VALUE_INITIALIZATION_NEEDS_MEMSET std::memset(&amp;x, 0, sizeof(x)); #endif </pre><p> But therefor, this macro needs to be defined in &lt;boost/config/compiler/...&gt;, for the relevant compiler versions. Hereby I have attached my proposed additions to the trunk version of boost/config/compiler: <a class="ext-link" href="https://svn.boost.org/trac/boost/attachment/ticket/3869/config_compiler.patch"><span class="icon">​</span>config_compiler.patch</a> Please check if it's okay. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Fri, 29 Jan 2010 15:27:36 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3869#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3869#comment:2</guid> <description> <p> The patch is OK as far as it goes, but we should have documentation and tests for each new macro, please see: <a href="http://www.boost.org/doc/libs/1_41_0/libs/config/doc/html/boost_config/guidelines_for_boost_authors.html#boost_config.guidelines_for_boost_authors.adding_new_defect_macros">http://www.boost.org/doc/libs/1_41_0/libs/config/doc/html/boost_config/guidelines_for_boost_authors.html#boost_config.guidelines_for_boost_authors.adding_new_defect_macros</a> </p> <p> Thanks, John. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>niels_dekker</dc:creator> <pubDate>Fri, 29 Jan 2010 17:14:57 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3869#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3869#comment:3</guid> <description> <p> Thanks, John. I read that there's a BOOST_NO_<em>SOMETHING</em> naming convention. So now I'm considering to name the macro <em>BOOST_NO_PROPER_VALUE_INITIALIZATION_FOR_ALL_TYPES</em>. (Instead of <em>BOOST_VALUE_INITIALIZATION_NEEDS_MEMSET</em>.) So that the unit test should show that compilers that have this macro defined do indeed do an improper value-initialization, for at least one type. </p> <p> I'll have a closer look later... </p> </description> <category>Ticket</category> </item> <item> <dc:creator>niels_dekker</dc:creator> <pubDate>Sun, 04 Apr 2010 14:14:10 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3869#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3869#comment:4</guid> <description> <p> Hereby I have just added a new patch for boost/config (to be applied to the trunk): <a class="ext-link" href="https://svn.boost.org/trac/boost/attachment/ticket/3869/no_complete_value_initialization.patch"><span class="icon">​</span>https://svn.boost.org/trac/boost/attachment/ticket/3869/no_complete_value_initialization.patch</a> It adds a new macro, BOOST_NO_COMPLETE_VALUE_INITIALIZATION, and includes documentation and tests. Please tell me what you think. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>niels_dekker</dc:creator> <pubDate>Wed, 07 Apr 2010 10:11:56 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/3869 https://svn.boost.org/trac10/ticket/3869 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">no_complete_value_initialization.patch</span> </li> </ul> <p> New proposed patch, adding BOOST_NO_COMPLETE_VALUE_INITIALIZATION. Replaces the old config_compiler.patch (Update: removed Boost.Test dependency, as suggested by John Maddock.) </p> Ticket niels_dekker Sun, 16 May 2010 11:39:26 GMT attachment set https://svn.boost.org/trac10/ticket/3869 https://svn.boost.org/trac10/ticket/3869 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">value_init_workaround.patch</span> </li> </ul> <p> Made memset call conditional, based on BOOST_NO_COMPLETE_VALUE_INITIALIZATION </p> Ticket niels_dekker Sun, 16 May 2010 12:01:49 GMT <link>https://svn.boost.org/trac10/ticket/3869#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3869#comment:5</guid> <description> <p> The <a class="ext-link" href="https://svn.boost.org/trac/boost/attachment/ticket/3869/value_init_workaround.patch"><span class="icon">​</span>value_init_workaround.patch</a> I just attached should resolve this ticket. It assumes that the defect macro BOOST_NO_COMPLETE_VALUE_INITIALIZATION is defined for those compilers that need it (ticket <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4080" title="#4080: Bugs: Various compilers need BOOST_NO_COMPLETE_VALUE_INITIALIZATION (closed: fixed)">#4080</a>). Note that it adds an extra macro, BOOST_DETAIL_VALUE_INIT_WORKAROUND (defined as either 0 or 1), which controls whether the memset workaround is applied. This macro is merely intended as an implementation detail: I would like to have an extra test which toggles the value of the macro, in order to check if the workaround is both effective and necessary. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>niels_dekker</dc:creator> <pubDate>Sun, 30 May 2010 09:19:12 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3869#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3869#comment:6</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/62307" title="Made memset call in value_init conditional, see #3869. Updated the ...">[62307]</a>) Made memset call in value_init conditional, see <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3869" title="#3869: Bugs: Unconditional call to memset in value_initialized() (closed: fixed)">#3869</a>. Updated the section "compiler issues" of its documentation. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>niels_dekker</dc:creator> <pubDate>Sun, 30 May 2010 12:47:24 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/3869 https://svn.boost.org/trac10/ticket/3869 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">value_init_workaround_test.cpp</span> </li> </ul> Ticket niels_dekker Wed, 16 Jun 2010 08:45:46 GMT <link>https://svn.boost.org/trac10/ticket/3869#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3869#comment:7</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/63014" title="Added value_init_workaround_test, reviewed by Fernando Cacciola, see #3869">[63014]</a>) Added value_init_workaround_test, reviewed by Fernando Cacciola, see <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3869" title="#3869: Bugs: Unconditional call to memset in value_initialized() (closed: fixed)">#3869</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>niels_dekker</dc:creator> <pubDate>Sun, 04 Jul 2010 21:56:49 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3869#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3869#comment:8</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/63638" title="Merged value_init fixes (extra tests + documentation) from trunk, see ...">[63638]</a>) Merged value_init fixes (extra tests + documentation) from trunk, see <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3472" title="#3472: Feature Requests: Setting value_initialized&lt;T&gt; to a value when T is a top-level const (closed: fixed)">#3472</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3869" title="#3869: Bugs: Unconditional call to memset in value_initialized() (closed: fixed)">#3869</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 03 Jun 2012 20:31:22 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3869#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3869#comment:9</guid> <description> <p> Is there something else to be added? If not, could you close the issue? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>niels_dekker</dc:creator> <pubDate>Mon, 04 Jun 2012 11:55:45 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3869#comment:10 https://svn.boost.org/trac10/ticket/3869#comment:10 <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> Closed, as suggested by Vicente (viboes). </p> Ticket