[Boost-bugs] [Boost C++ Libraries] #1518: Warning from gcc in boost/intrusive/detail/utilities.hpp

Subject: [Boost-bugs] [Boost C++ Libraries] #1518: Warning from gcc in boost/intrusive/detail/utilities.hpp
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-12-10 13:14:19


#1518: Warning from gcc in boost/intrusive/detail/utilities.hpp
-----------------------------------------------+----------------------------
 Reporter: Lars Hagström <lars_at_[hidden]> | Owner: igaztanaga
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: interprocess
  Version: Boost 1.34.1 | Severity: Cosmetic
 Keywords: |
-----------------------------------------------+----------------------------
 When compiling with -Wall and -O2 or -O3 I get the following warning:

 {{{
 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
 }}}

 This is with boost intrusive and interprocess from revision 41303.

 Changing the first line of fast_log2 to

 {{{
 boost::uint32_t * const exp_ptr =
   static_cast <boost::uint32_t * const>
    (static_cast<void * const >(&val));
 }}}

 Makes this warning go away. Although I'm not so sure about the beauty and
 efficiency of casting that way...

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1518>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.


This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC