To ensure that we return properly aligned pointers from sos_alloc(), MAX_ALIGN must be a power-of-two. On i386 the power-of-two assumption fails as sizeof(long double) = 12. Fix this by rounding up to 16. --- src/mi/mempool.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/mi/mempool.c b/src/mi/mempool.c index b49202b..66cb099 100644 --- a/src/mi/mempool.c +++ b/src/mi/mempool.c @@ -31,7 +31,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifdef __BIGGEST_ALIGNMENT__ # define MAX_ALIGN __BIGGEST_ALIGNMENT__ #else -# define MAX_ALIGN (sizeof (long double)) +/* Crude hack to check that MAX_ALIGN is power-of-two. + * sizeof(long double) = 12 on i386. */ +# define MAX_ALIGN_(n) (n < 8 ? 8 : \ + n < 16 ? 16 : n) +# define MAX_ALIGN MAX_ALIGN_(sizeof (long double)) #endif static char sos_memory[SOS_MEMORY_SIZE]; -- 1.7.9.5 _______________________________________________ Libunwind-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/libunwind-devel
