[Boost-bugs] [Boost C++ Libraries] #7901: jam's hash.c misaligns hashed entries

Subject: [Boost-bugs] [Boost C++ Libraries] #7901: jam's hash.c misaligns hashed entries
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-01-17 16:05:56


#7901: jam's hash.c misaligns hashed entries
-------------------------------+--------------------------------------------
 Reporter: martin@… | Type: Bugs
   Status: new | Milestone: To Be Determined
Component: Building Boost | Version: Boost 1.52.0
 Severity: Problem | Keywords:
-------------------------------+--------------------------------------------
 On platforms where a void* is smaller (e.g. 32bit) than a time_t (e.g.
 64bit) and where the cpu requires strict alignment, jam bus errors already
 during bootstrap. NetBSD/sparc is an example for such a platform.

 This is because the hash_item_data macro () casts to char* and adds sizeof
 a struct only containing a pointer, while later filesys code stores
 file_info_t structures in a hash (which include time_t members and need
 greater alignment).

 Since this is all needed very early, the easiest and most portable
 solution is to force sizeof(ITEM) to be great enough for the required
 alignment by making it a union including a dummy time_t member. This has
 the benefit of beeing a no-op for non affected architectures.

 I have a patch tested against the 1.52 release, but the idea should be
 obvious and applying it to the (a bit different) trunk code should be
 straighforward. Please let me know if you need a real patch against trunk.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7901>
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:50:11 UTC