Fix undefined behaviour in FreeBSD PAL.
We were passing an argument less than 4K to the MAP_ALIGNED macro, which caused an undefined shift. The compiler helpfully propagated the undef values back to earlier in the code and gave us some exciting nonsense.
This commit is contained in:
@@ -77,10 +77,7 @@ namespace snmalloc
|
||||
// Alignment must be a power of 2.
|
||||
assert(align == bits::next_pow2(align));
|
||||
|
||||
if (align == 0)
|
||||
{
|
||||
align = 1;
|
||||
}
|
||||
align = bits::max<size_t>(4096, align);
|
||||
|
||||
size_t log2align = bits::next_pow2_bits(align);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user