Fixes a GCC compile issue on the elfutils-debian-i686 buildbot builder:
dwarf_getlocation_attr.c: In function ‘addr_valp’:
dwarf_getlocation_attr.c:62:12: error: cast to pointer from integer of
different size [-Werror=int-to-pointer-cast]
return (unsigned char *) offset;
^
cc1: all warnings being treated as errors
Signed-off-by: Mark Wielaard <[email protected]>
---
libdw/ChangeLog | 5 +++++
libdw/dwarf_getlocation_attr.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 526c91f..fd59a24 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,8 @@
+2018-05-25 Mark Wielaard <[email protected]>
+
+ * dwarf_getlocation_attr.c (__libdw_cu_addr_base): Cast offset to
+ uintptr_t before returning as pointer.
+
2018-05-22 Mark Wielaard <[email protected]>
* dwarf_getlocation.c (__libdw_cu_base_address): Treat errors of
diff --git a/libdw/dwarf_getlocation_attr.c b/libdw/dwarf_getlocation_attr.c
index 62ef47a..9d7fd4b 100644
--- a/libdw/dwarf_getlocation_attr.c
+++ b/libdw/dwarf_getlocation_attr.c
@@ -59,7 +59,7 @@ addr_valp (Dwarf_CU *cu, Dwarf_Word index)
Dwarf_Word offset = __libdw_cu_addr_base (cu) + (index * cu->address_size);
if (debug_addr == NULL)
/* This is really an error, will trigger with dwarf_formaddr. */
- return (unsigned char *) offset;
+ return (unsigned char *) (uintptr_t) offset;
return (unsigned char *) debug_addr->d_buf + offset;
}
--
1.8.3.1