GCC6 will warn about the reassignement of the nonnull result pointer.
The reassignment is indeed a little questionable. The compiler cannot
see that the pointer will not actually be reassigned since the function
will just return the same pointer value except when the dwarf_formref_die
function fails. In which case we don't use the result anymore. So the
compiler has to pessimistically assume the pointer will need to be
reloaded in the loop every time. Help the compiler generate slightly
better code by just checking whether the function fails directly instead
of reusing the pointer value for this.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
+2015-09-15 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_peel_type.c (dwarf_peel_type): Don't reassign result pointer.
+
2015-09-09 Chih-Hung Hsieh <chh@google.com>
* dwarf_macro_getsrcfiles.c (dwarf_macro_getsrcfiles): Remove
/* Peel type aliases and qualifier tags from a type DIE.
- Copyright (C) 2014 Red Hat, Inc.
+ Copyright (C) 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
if (attr == NULL)
return 1;
- result = INTUSE (dwarf_formref_die) (attr, result);
- if (result == NULL)
+ if (INTUSE (dwarf_formref_die) (attr, result) == NULL)
return -1;
tag = INTUSE (dwarf_tag) (result);