Opened 15 years ago

Closed 15 years ago

#1518 closed Bugs (fixed)

Warning from gcc in boost/intrusive/detail/utilities.hpp

Reported by: Lars Hagström <lars@…> Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.34.1 Severity: Cosmetic
Keywords: Cc:

Description

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...

Change History (1)

comment:1 by Ion Gaztañaga, 15 years ago

Resolution: fixed
Status: newclosed

Solved in revision 42007

Note: See TracTickets for help on using tickets.