summaryrefslogtreecommitdiff
path: root/libdw
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2015-02-11 13:53:14 -0800
committerJosh Stone <jistone@redhat.com>2015-02-11 15:50:44 -0800
commit031db7ce5f149c8469ac33f688a09ffb15c5d85d (patch)
tree2d1d32b5c0f395bb8015d5a53c03fef41ef1683a /libdw
parentb4da85ded5de790aa2cddd6d725970945c97df89 (diff)
downloadelfutils-031db7ce5f149c8469ac33f688a09ffb15c5d85d.tar.gz
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>
Diffstat (limited to 'libdw')
-rw-r--r--libdw/ChangeLog4
-rw-r--r--libdw/encoded-value.h2
2 files changed, 5 insertions, 1 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 212b87be..dd73c908 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -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
diff --git a/libdw/encoded-value.h b/libdw/encoded-value.h
index f953f5ef..0fa20183 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)
{