summaryrefslogtreecommitdiff
path: root/libdw/dwarf_getattrs.c
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2018-11-23 20:50:51 +0100
committerMark Wielaard <mark@klomp.org>2018-11-23 21:06:30 +0100
commitffbe89d87918559ee38c65be16d39b42608735e8 (patch)
tree598794005c060a60da62799eb65fba13b503077b /libdw/dwarf_getattrs.c
parent628b4a93c6863b9982d817db6acaacbc4e116453 (diff)
downloadelfutils-ffbe89d87918559ee38c65be16d39b42608735e8.tar.gz
libdw: Enable building with -Og.
When building with -Og gcc is unable to see that __libdw_dieabbrev () will initialize what the second argument points to when no error occurs as called by dwarf_child and dwarf_getattrs. Causing an possibly uninitialized error. Just initialize readp/die_addr to NULL, which is the value we would return if an error occurs anyway. https://sourceware.org/bugzilla/show_bug.cgi?id=23914 Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'libdw/dwarf_getattrs.c')
-rw-r--r--libdw/dwarf_getattrs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libdw/dwarf_getattrs.c b/libdw/dwarf_getattrs.c
index 50faf988..4ac16b1a 100644
--- a/libdw/dwarf_getattrs.c
+++ b/libdw/dwarf_getattrs.c
@@ -44,7 +44,7 @@ dwarf_getattrs (Dwarf_Die *die, int (*callback) (Dwarf_Attribute *, void *),
if (unlikely (offset == 1))
return 1;
- const unsigned char *die_addr;
+ const unsigned char *die_addr = NULL;
/* Find the abbreviation entry. */
Dwarf_Abbrev *abbrevp = __libdw_dieabbrev (die, &die_addr);