From: Mark Wielaard Date: Sun, 29 Sep 2013 22:39:07 +0000 (+0200) Subject: libdw: Fix compiler warnings on 32-bit. X-Git-Tag: elfutils-0.157~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=74f9b7337562c06a93722ad757d258db8f082663;p=thirdparty%2Felfutils.git libdw: Fix compiler warnings on 32-bit. 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 --- diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 21cc4854b..951f1cba6 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,12 @@ +2013-09-29 Mark Wielaard + + * 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 * libdw_visit_scopes.c (classify_die): Removed. diff --git a/libdw/dwarf_getlocation.c b/libdw/dwarf_getlocation.c index f7d64f417..ff25fc7cd 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 2d6084e98..bf1558409 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: