]> git.kaiwu.me - haproxy.git/commit
BUILD: quic: workaround a gcc bug saying "maybe used uninitialized" when USE_TRACE=0
authorWilly Tarreau <w@1wt.eu>
Wed, 1 Jul 2026 13:09:10 +0000 (15:09 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 3 Jul 2026 14:32:28 +0000 (16:32 +0200)
commit4fe06d8c83e4a5ac6fea144cdfddd145f49ed929
treed9db2977ce308574da9640a49138b305b9be5b6b
parent364d16030a2c2715f28e8b345ab83a788b89d23a
BUILD: quic: workaround a gcc bug saying "maybe used uninitialized" when USE_TRACE=0

In quic_transport_params_store(), we call qc_early_transport_params_cpy()
if edata_accepted is set, which copies one by one all tx_params into the
locally allocated etps struct, and later after updates we call
qc_early_transport_params_validate() to check if they changed. It turns
out that when USE_TRACE is disabled, gcc 4 to 13 are confused and believe
that one or several of the fields compared in the later function might be
used uninitialized. A careful code inspection proves that this is not the
case. Setting them to zero in the _cpy() function makes the warning
disappear, it's really an issue related to variable propagation it seems,
which can explain why it doesn't happen with traces (code is a bit more
complex). Gcc-13 only emits a warning about a single field, and gcc-14
completely solved it. Playing with consts, __maybe_unused etc has no
effect.

One thing works however, it is to mark the _validate() function noinline.
In this case it is implemented normally and the compiler doesn't put its
nose into the propagation path and doesn't complain.

Such comments are always scary because one may seriously wonder whether
the compiler emits valid code when it says this...

It should be backported to 3.4 which experiences the same warning with
USE_TRACE=0.
src/quic_tp.c