With CFLAGS='-Og -g', F21 gcc hits -Werror=maybe-uninitialized in read_encoded_value at "*result += value". It's fine with -O2/-O0.
In particular it seems to care about the __libdw_cfi_read_address_inc calls. By my inspection, the only way those don't set value are for error cases, which will then return immediately. This patch just sets value = 0 to begin with, so gcc is always convinced it's fine. Signed-off-by: Josh Stone <[email protected]> --- libdw/ChangeLog | 4 ++++ libdw/encoded-value.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index d377937ff57c..b6ad425d8640 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,7 @@ +2015-02-11 Josh Stone <[email protected]> + + * encoded-value.h (read_encoded_value): Initialize value. + 2014-12-24 Mark Wielaard <[email protected]> * dwarf_getsrc_die.c (dwarf_getsrc_die): Return the last line record diff --git a/libdw/encoded-value.h b/libdw/encoded-value.h index f953f5ef2a5f..0fa201835c5e 100644 --- a/libdw/encoded-value.h +++ b/libdw/encoded-value.h @@ -152,7 +152,7 @@ read_encoded_value (const Dwarf_CFI *cache, uint8_t encoding, return true; } - Dwarf_Addr value; + Dwarf_Addr value = 0; const unsigned char *endp = cache->data->d.d_buf + cache->data->d.d_size; switch (encoding & 0x0f) { -- 2.1.0
