]> git.kaiwu.me - haproxy.git/commit
IMPORT: uslz: fix a build warning with gcc -O1
authorWilly Tarreau <w@1wt.eu>
Tue, 1 Dec 2026 10:56:22 +0000 (11:56 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 1 Dec 2026 13:09:51 +0000 (14:09 +0100)
commitfda1a5d1dac73ece12f8281da21d759c7a87f261
treeb8014df96b72dc028cc0102c55513ee72be75bab
parent61261c539ac4992d6286b5a4bad57fe6cf3681d4
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.
src/uslz.c