Workaround for gcc array bound check issue

V8 doesn't build on Ubuntu 16.04 (with GCC 5.3). Seems to be
a known regression on newer GCC version. It emits incorrect
"error: array subscript is above array bounds" message. Adding
explicit array bound check fixes the issue.

R=hablich@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2256113002
Cr-Commit-Position: refs/heads/master@{#38721}
This commit is contained in:
bjaideep 2016-08-18 07:42:48 -07:00 committed by Commit bot
parent 280fdf6411
commit 757ea240f4

View File

@ -194,9 +194,15 @@ class SlotSet : public Malloced {
}
void MaskCell(int bucket_index, int cell_index, uint32_t mask) {
uint32_t* cells = bucket[bucket_index];
if (cells != nullptr && cells[cell_index] != 0) {
cells[cell_index] &= mask;
if (bucket_index < kBuckets) {
uint32_t* cells = bucket[bucket_index];
if (cells != nullptr && cells[cell_index] != 0) {
cells[cell_index] &= mask;
}
} else {
// GCC bug 59124: Emits wrong warnings
// "array subscript is above array bounds"
UNREACHABLE();
}
}