Opened 8 years ago

Closed 8 years ago

#10886 closed Bugs (fixed)

boost::hash_detail::hash_binary() Triggers GCC Strict Aliasing Warning

Reported by: Rob Stewart <rstewart@…> Owned by: Daniel James
Milestone: To Be Determined Component: hash
Version: Boost 1.57.0 Severity: Problem
Keywords: hash type-punning string-aliasing warning Cc:

Description

http://lists.boost.org/Archives/boost/2008/04/136209.php discusses the issue and provides a fix, but the problem persists in develop. This fix is long overdue.

The problem is that boost::hash_detail::hash_binary() casts its char * parameter to std::size_t * when called by boost::hash_detail::float_hash_impl(), which casts its float parameter to char * to pass as boost::hash_detail::hash_binary()'s char * argument, when called by boost::hash_detail::float_hash_value().

Change History (2)

comment:1 by andy@…, 8 years ago

I'm going to submit a pull request on github for the fix. It's a one-liner and uses the memcpy convention used elsewhere in the file.

comment:2 by Daniel James, 8 years ago

Resolution: fixed
Status: newclosed

Pull request at: https://github.com/boostorg/functional/pull/3

I've cherry picked it into develop, will merge to master if there aren't any problems.

Note: See TracTickets for help on using tickets.