]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdw: Fix compiler warnings on 32-bit.
authorMark Wielaard <mjw@redhat.com>
Sun, 29 Sep 2013 22:39:07 +0000 (00:39 +0200)
committerMark Wielaard <mjw@redhat.com>
Sun, 29 Sep 2013 22:39:13 +0000 (00:39 +0200)
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 <mjw@redhat.com>
libdw/ChangeLog
libdw/dwarf_getlocation.c
libdw/dwarf_getlocation_attr.c

index 21cc4854b23553e06823cf2a208e74102f4bcbaf..951f1cba6e2ccb8bc4416ee8905eaf576e830ff9 100644 (file)
@@ -1,3 +1,12 @@
+2013-09-29  Mark Wielaard  <mjw@redhat.com>
+
+       * 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  <jistone@redhat.com>
 
        * libdw_visit_scopes.c (classify_die): Removed.
index f7d64f4176ce60bc2fb3a702590f28e364b860d6..ff25fc7cde2d64cafa30ae962396a0ca30cbbf2c 100644 (file)
@@ -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;
index 2d6084e98b997fbe02340316da36845de9de8c3f..bf1558409ea7c2fea5d3838573bd795b13104594 100644 (file)
@@ -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: