mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-18 13:05:38 +00:00
BUILD: checks: shut up yet another stupid gcc warning
gcc has always had hallucinations regarding value ranges, and this one is interesting, and affects branches 4.7 to 11.3 at least. When building without threads, the randomly picked new_tid that is reduced to a multiply by 1 shifted right 32 bits, hence a constant output of 0 shows this warning: src/check.c: In function 'process_chk_conn': src/check.c:1150:32: warning: array subscript [-1, 0] is outside array bounds of 'struct thread_ctx[1]' [-Warray-bounds] In file included from include/haproxy/thread.h:28, from include/haproxy/list.h:26, from include/haproxy/action.h:28, from src/check.c:31: or this one when trying to force the test to see that it cannot be zero(!): src/check.c: In function 'process_chk_conn': src/check.c:1150:54: warning: array subscript [0, 0] is outside array bounds of 'struct thread_ctx[1]' [-Warray-bounds] 1150 | uint t2_act = _HA_ATOMIC_LOAD(&ha_thread_ctx[thr2].active_checks); | ~~~~~~~~~~~~~^~~~~~ include/haproxy/atomic.h:66:40: note: in definition of macro 'HA_ATOMIC_LOAD' 66 | #define HA_ATOMIC_LOAD(val) *(val) | ^~~ src/check.c:1150:24: note: in expansion of macro '_HA_ATOMIC_LOAD' 1150 | uint t2_act = _HA_ATOMIC_LOAD(&ha_thread_ctx[thr2].active_checks); | ^~~~~~~~~~~~~~~ Let's just add an ALREADY_CHECKED() statement there, no other check seems to get rid of it. No backport is needed.
This commit is contained in:
parent
17a7baca07
commit
fca3fc0d90
@ -1212,6 +1212,8 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state)
|
||||
if (new_tid == tid)
|
||||
continue;
|
||||
|
||||
ALREADY_CHECKED(new_tid);
|
||||
|
||||
if (check_thread_cmp_active(tid, new_tid) > 0 &&
|
||||
(run_checks >= global.tune.max_checks_per_thread ||
|
||||
check_thread_cmp_load(tid, new_tid) > 0)) {
|
||||
|
Loading…
Reference in New Issue
Block a user