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>
+2018-10-23 Mark Wielaard <mark@klomp.org>
+
+ * dwarf_child.c (__libdw_find_attr): Initialize readp to NULL.
+ * dwarf_getattrs.c (dwarf_getattrs): Initialize die_addr to NULL.
+
2018-10-20 Mark Wielaard <mark@klomp.org>
* libdw.map (ELFUTILS_0.175): New section. Add dwelf_elf_begin.
__libdw_find_attr (Dwarf_Die *die, unsigned int search_name,
unsigned int *codep, unsigned int *formp)
{
- const unsigned char *readp;
+ const unsigned char *readp = NULL;
/* Find the abbreviation entry. */
Dwarf_Abbrev *abbrevp = __libdw_dieabbrev (die, &readp);
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);