Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Buddy
ranges can be instantiated withMAX_SIZE_BITS == MIN_SIZE_BITS
(or, in principle,<=
). If this happens, the resulting class will contain 0-length arrays, and code that appears to attempt to access an element therein trips gcc's-Warray-bounds
.This PR contains two commits: one that adds a
static_assert
to ensure thatBuddy
's arrays are always of positive size, and one possible way to fix the case I'm tripping over. The latter works because the Buddy'sMIN_SIZE_BITS
is instantiated atMIN_CHUNK_BITS
, and so the change herein then ensures that itsMAX_SIZE_BITS
is strictly greater thanMIN_CHUNK_BITS
.A different, and possibly better, solution would be to drop the
LargeBuddyRange
fromCentralMetaRange
whenmax_page_chunk_size_bits
is computed to be equal toMIN_CHUNK_BITS
.Please advise.