Boost C++ Libraries: Ticket #1518: Warning from gcc in boost/intrusive/detail/utilities.hpp https://svn.boost.org/trac10/ticket/1518 <p> When compiling with -Wall and -O2 or -O3 I get the following warning: </p> <pre class="wiki">intrusive/detail/utilities.hpp: In function 'float boost::intrusive::detail::fast_log2(float)': intrusive/detail/utilities.hpp:501: warning: dereferencing type-punned pointer will break strict-aliasing rules </pre><p> This is with boost intrusive and interprocess from revision 41303. </p> <p> Changing the first line of fast_log2 to </p> <pre class="wiki">boost::uint32_t * const exp_ptr = static_cast &lt;boost::uint32_t * const&gt; (static_cast&lt;void * const &gt;(&amp;val)); </pre><p> Makes this warning go away. Although I'm not so sure about the beauty and efficiency of casting that way... </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1518 Trac 1.4.3 Ion Gaztañaga Thu, 13 Dec 2007 16:52:24 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/1518#comment:1 https://svn.boost.org/trac10/ticket/1518#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> Solved in revision 42007 </p> Ticket