You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On the Debian SPARC64 port the sumset test fails with SIGBUS with the following circumstances:
0x0000010000002344 in rs_block_sig_init (sig=0x1000010815a, weak_sum=463471464, strong_sum=0x7fefffff0e8, strong_len=6) at ./src/sumset.c:41
41 sig->weak_sum = weak_sum;
As you can see, sig is not aligned on 4 while sig->weak_sum has size 4. Looks like it's because block_sigs is an unpadded array of structures of size 6.
The text was updated successfully, but these errors were encountered:
My bad, I should have realized that would be a problem when I did the packed rs_block_sigs to save memory.
I'll try to fix it in the next week or so. What is the best practice for avoiding alignment problems like this? Would aligning it to sizeof(int) be good enough? Or should I align to sizeof(rs_weak_sum_t) be better (since that's the size of the first element of the rs_block_sig_t.
You can use __alignof__(rs_block_sig_t) to find out the minimum alignment requirements. That's non-standard (though both GCC and Clang implement it), and it's always safe to align to sizeof(largest_member). The structure alignment is always defined recursively as the maximum alignment over each of its members, so no, just looking at the first member isn't correct (though may happen to be if it also has the strictest alignment requirements).
On the Debian SPARC64 port the sumset test fails with SIGBUS with the following circumstances:
As you can see,
sig
is not aligned on 4 whilesig->weak_sum
has size 4. Looks like it's becauseblock_sigs
is an unpadded array of structures of size 6.The text was updated successfully, but these errors were encountered: