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.
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)