Skip to content

Commit

Permalink
Update pl-inline.h: less intrusive change
Browse files Browse the repository at this point in the history
That change silences the warning too.

So either the array-bounds warning is a false positive, or the assertion n%sizeof(word) isn't always met.
  • Loading branch information
mgondan authored Jan 4, 2025
1 parent 9fa5d53 commit d1bc81a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pl-inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,9 @@ murmur_key(const void *ptr, size_t n)

for(size_t i=0; i<KEY_INDEX_MAX-2; i++)
data[i] = in[i];
data[KEY_INDEX_MAX-2] = in[n/sizeof(word)-2];

/* the extra n%... silences a -Warray-bounds warning */
data[KEY_INDEX_MAX-2] = in[n/sizeof(word) - n%sizeof(word) - 1];
data[KEY_INDEX_MAX-1] = n;

k = MurmurHashAligned2(data, sizeof(word)*4, MURMUR_SEED);
Expand Down

0 comments on commit d1bc81a

Please sign in to comment.