diff options
author | Trevor Saunders <tbsaunde+binutils@tbsaunde.org> | 2016-04-13 05:17:31 -0400 |
---|---|---|
committer | Trevor Saunders <tbsaunde+binutils@tbsaunde.org> | 2016-04-26 20:09:57 -0400 |
commit | 28cc9170c3d0bc0c5e82b45a10015e4bbcb01125 (patch) | |
tree | 39cc9b5d7af7877b58da8d4a2e8cf708a7cf64fd /bfd/mmo.c | |
parent | Automatic date update in version.in (diff) | |
download | binutils-gdb-28cc9170c3d0bc0c5e82b45a10015e4bbcb01125.tar.gz binutils-gdb-28cc9170c3d0bc0c5e82b45a10015e4bbcb01125.tar.bz2 binutils-gdb-28cc9170c3d0bc0c5e82b45a10015e4bbcb01125.zip |
add casts to avoid arithmetic on void *
arithmetic on void * is undefined in ISO C, so we should avoid it. In
GNU C sizeof void * is defined as 1, and that is pretty clearly what
this code wants, so change it to do arithmetic on bfd_byte *.
Unfortunately most of the argument types come from virtual function
interfaces so changing the types to bfd_byte * isn't trivial though it
might make the code clearer. So for the moment its easiest to leave the
variable types as void * and cast before doing arithmetic.
bfd/ChangeLog:
2016-04-26 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* elf32-rx.c (rx_set_section_contents): Avoid arithmetic on void *.
* mmo.c (mmo_get_section_contents): Likewise.
(mmo_set_section_contents): Likewise.
Diffstat (limited to 'bfd/mmo.c')
-rw-r--r-- | bfd/mmo.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bfd/mmo.c b/bfd/mmo.c index b8af63a711f..dbfc9acbb27 100644 --- a/bfd/mmo.c +++ b/bfd/mmo.c @@ -2120,7 +2120,7 @@ mmo_get_section_contents (bfd *abfd ATTRIBUTE_UNUSED, memcpy (location, loc, chunk_size); - location += chunk_size; + location = (bfd_byte *) location + chunk_size; bytes_to_do -= chunk_size; offset += chunk_size; } @@ -2657,7 +2657,7 @@ mmo_set_section_contents (bfd *abfd ATTRIBUTE_UNUSED, sec_ptr sec, memcpy (loc, location, chunk_size); - location += chunk_size; + location = (bfd_byte *) location + chunk_size; bytes_to_do -= chunk_size; offset += chunk_size; } |