Opened 10 years ago
Last modified 8 years ago
#7901 new Bugs
jam's hash.c misaligns hashed entries
Reported by: | Owned by: | Vladimir Prus | |
---|---|---|---|
Milestone: | To Be Determined | Component: | build |
Version: | Boost 1.52.0 | Severity: | Problem |
Keywords: | Cc: |
Description
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.
Attachments (1)
Change History (2)
by , 10 years ago
comment:1 by , 8 years ago
Component: | Building Boost → build |
---|---|
Owner: | set to |
working patch against 1.52