Don't cast directly to/from Dwarf_Word (uint64_t) to/from pointers, but use uintptr_t as intermediary to prevent cast to pointer from integer of different size warnings.
Signed-off-by: Mark Wielaard <[email protected]> --- libdw/ChangeLog | 9 +++++++++ libdw/dwarf_getlocation.c | 8 +++++--- libdw/dwarf_getlocation_attr.c | 6 +++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 21cc485..951f1cb 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,12 @@ +2013-09-29 Mark Wielaard <[email protected]> + + * dwarf_getlocation.c (store_implicit_value): Cast op->number2 to + uintptr_t before casting to char *. + (__libdw_intern_expression): Cast data to uintptr_t before casting + to Dwarf_Word. + * dwarf_getlocation_attr.c (dwarf_getlocation_attr): Cast + op->number2 to uintptr_t before casting to char *. + 2013-09-24 Josh Stone <[email protected]> * libdw_visit_scopes.c (classify_die): Removed. diff --git a/libdw/dwarf_getlocation.c b/libdw/dwarf_getlocation.c index f7d64f4..ff25fc7 100644 --- a/libdw/dwarf_getlocation.c +++ b/libdw/dwarf_getlocation.c @@ -99,7 +99,7 @@ store_implicit_value (Dwarf *dbg, void **cache, Dwarf_Op *op) { struct loc_block_s *block = libdw_alloc (dbg, struct loc_block_s, sizeof (struct loc_block_s), 1); - const unsigned char *data = (const unsigned char *) op->number2; + const unsigned char *data = (const unsigned char *) (uintptr_t) op->number2; Dwarf_Word blength; // Ignored, equal to op->number. get_uleb128 (blength, data); block->addr = op; @@ -414,7 +414,8 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order, if (unlikely (dbg == NULL)) goto invalid; - newloc->number2 = (Dwarf_Word) data; /* start of block inc. len. */ + /* start of block inc. len. */ + newloc->number2 = (Dwarf_Word) (uintptr_t) data; /* XXX Check size. */ get_uleb128 (newloc->number, data); /* Block length. */ if (unlikely ((Dwarf_Word) (end_data - data) < newloc->number)) @@ -447,7 +448,8 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order, if (unlikely (data >= end_data)) goto invalid; - newloc->number2 = (Dwarf_Word) data; /* start of block inc. len. */ + /* start of block inc. len. */ + newloc->number2 = (Dwarf_Word) (uintptr_t) data; size = *data++; if (unlikely ((Dwarf_Word) (end_data - data) < size)) goto invalid; diff --git a/libdw/dwarf_getlocation_attr.c b/libdw/dwarf_getlocation_attr.c index 2d6084e..bf15584 100644 --- a/libdw/dwarf_getlocation_attr.c +++ b/libdw/dwarf_getlocation_attr.c @@ -50,19 +50,19 @@ dwarf_getlocation_attr (attr, op, result) case DW_OP_implicit_value: result->code = DW_AT_const_value; result->form = DW_FORM_block; - result->valp = (unsigned char *) op->number2; + result->valp = (unsigned char *) (uintptr_t) op->number2; break; case DW_OP_GNU_entry_value: result->code = DW_AT_location; result->form = DW_FORM_exprloc; - result->valp = (unsigned char *) op->number2; + result->valp = (unsigned char *) (uintptr_t) op->number2; break; case DW_OP_GNU_const_type: result->code = DW_AT_const_value; result->form = DW_FORM_block1; - result->valp = (unsigned char *) op->number2; + result->valp = (unsigned char *) (uintptr_t) op->number2; break; case DW_OP_call2: -- 1.8.3.1
