[COMMITTED] __libdw_cu_addr_base: Cast offset to uintptr_t before returning as pointer.
Mark Wielaard
mark@klomp.org
Fri May 25 13:49:00 GMT 2018
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 <mark@klomp.org>
---
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 <mark@klomp.org>
+
+ * dwarf_getlocation_attr.c (__libdw_cu_addr_base): Cast offset to
+ uintptr_t before returning as pointer.
+
2018-05-22 Mark Wielaard <mark@klomp.org>
* 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
More information about the Elfutils-devel
mailing list