libdw: ensure read_encoded_value's value is set

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 <jistone@redhat.com>
This commit is contained in:
Josh Stone
2015-02-11 13:53:14 -08:00
parent b4da85ded5
commit 031db7ce5f
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -1,3 +1,7 @@
2015-02-11 Josh Stone <jistone@redhat.com>
* encoded-value.h (read_encoded_value): Initialize value.
2015-02-11 Petr Machata <pmachata@redhat.com>
* dwarf_ranges.c (dwarf_ranges): Do not bail out when neither
+1 -1
View File
@@ -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)
{