Commit c68c7248 authored by Leszek Swirski's avatar Leszek Swirski Committed by V8 LUCI CQ

[gcc] Suppress array bounds warning

Suppress a gcc array bounds warning in ComputeStackLimit, where we are
very intentionally accessing a location out of bounds.

Bug: chromium:1307180
Change-Id: If4b7ce182472a761f9f619824676e5e660b0277a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3732109
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81416}
parent add88110
......@@ -16564,7 +16564,12 @@ static void GetStackLimitCallback(
// Given a size, returns an address that is that far from the current
// top of stack.
static uint32_t* ComputeStackLimit(uint32_t size) {
// Disable the gcc error which (very correctly) notes that this is an
// out-of-bounds access.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
uint32_t* answer = &size - (size / sizeof(size));
#pragma GCC diagnostic pop
// If the size is very large and the stack is very near the bottom of
// memory then the calculation above may wrap around and give an address
// that is above the (downwards-growing) stack. In that case we return
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment