From 059b6b1b612f04e1d8f447b080d2ecbd37fc011d Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 25 May 2018 15:46:09 +0200 Subject: [PATCH] __libdw_cu_addr_base: Cast offset to uintptr_t before returning as pointer. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- 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 526c91f43..fd59a2472 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,8 @@ +2018-05-25 Mark Wielaard + + * dwarf_getlocation_attr.c (__libdw_cu_addr_base): Cast offset to + uintptr_t before returning as pointer. + 2018-05-22 Mark Wielaard * 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 62ef47abf..9d7fd4b58 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; } -- 2.47.2