On Thu, 2015-02-12 at 00:22 +0100, Petr Machata wrote:
Josh Stone <jistone(a)redhat.com> writes:
> With CFLAGS='-Og -g', F21 gcc hits -Werror=maybe-uninitialized in
> read_encoded_value at "*result += value". It's fine with -O2/-O0.
>
> By my inspection, the only way those don't set value are for error
> cases, which will then return immediately.
Looks good to me. I don't see how we could end up using value
uninitialized either, but oh well.
Agreed. In general I don't like working around limitations in the
compiler not correctly deducing things like this. Especially since it
does seem to figure things out fine with -O0/-O2. But in both this case
and the test case the explicit initialization seems harmless/not on a
critical path. And it is nice to have -Og work for those that want to
use it.
Thanks,
Mark