BUILD: thread: silence a build warning when threads are disabled

When threads are disabled, the compiler complains that we might be
accessing tg->abs[] out of bounds since the array is of size 1. It
cannot know that the condition to do this is never met, and given
that it's not in a fast path, we can make it more obvious.
This commit is contained in:
Willy Tarreau 2023-03-22 10:28:50 +01:00
parent 0de1e6180a
commit 1b536a11e7

View File

@ -1261,7 +1261,9 @@ int thread_resolve_group_mask(struct thread_set *ts, int defgrp, char **err)
uint base = ha_tgroup_info[g].base % LONGBITS;
mask = ts->abs[block] >> base;
if (base && ha_tgroup_info[g].count > (LONGBITS - base))
if (base &&
(block + 1) < sizeof(ts->abs) / sizeof(ts->abs[0]) &&
ha_tgroup_info[g].count > (LONGBITS - base))
mask |= ts->abs[block + 1] << (LONGBITS - base);
mask &= nbits(ha_tgroup_info[g].count);
mask &= ha_tgroup_info[g].threads_enabled;