From: Willy Tarreau Date: Tue, 1 Dec 2026 10:56:22 +0000 (+0100) Subject: IMPORT: uslz: fix a build warning with gcc -O1 X-Git-Url: https://git.kaiwu.me/http/%22../doc/static/%7B@url%7D?a=commitdiff_plain;h=fda1a5d1dac73ece12f8281da21d759c7a87f261;p=haproxy.git IMPORT: uslz: fix a build warning with gcc -O1 At -O1, gcc emits this warning because it doesn't clearly see that all paths reach this place with sym properly initialized: src/uslz.c: In function 'uslz_eob_follows': src/uslz.c:745:18: warning: 'sym' may be used uninitialized in this function [-Wmaybe-uninitialized] 745 | if (!ret || sym != 256) | ~~~~~^~~~~~~~~~~~~ Let's just preset it to zero. Unfortunately it slightly inflates the code with more instructions and stack usage because the compiler does not see that the called functions don't use it, but it has almost no impact on measured performance. Another approach consists in passing the pointer to state->symbol, but even if it reduces the code, it suffers a bigger slowdown likely due to having to access the member that's a bit colder in the cache. This is slz commit 544c4d5cca. No backport to haproxy stable versions is needed. --- diff --git a/src/uslz.c b/src/uslz.c index 3632e2f53..fb296341b 100644 --- a/src/uslz.c +++ b/src/uslz.c @@ -731,7 +731,7 @@ int uslz_eob_follows(struct uslz_stream *state) unsigned long bit_accum = state->bit_accum; unsigned char num_bits = state->num_bits; unsigned int hi = state->huff_index; - unsigned int sym; + unsigned int sym = 0; int ret; if (state->dec_bsize < state->out_max || state->state != USLZ_ST_READ_SYMBOL)