This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: [PATCH 1/2] libdw: ensure read_encoded_value's value is set
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Thu, 12 Feb 2015 12:32:52 +0100
- Subject: Re: [PATCH 1/2] libdw: ensure read_encoded_value's value is set
On Thu, 2015-02-12 at 00:22 +0100, Petr Machata wrote:
> Josh Stone <jistone@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