[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] exec-all: Fix void pointer arithmetic
From: |
Stefan Weil |
Subject: |
[Qemu-devel] [PATCH] exec-all: Fix void pointer arithmetic |
Date: |
Sun, 23 Oct 2011 08:19:10 +0200 |
Adding an offset to a void pointer works with gcc but is not allowed
by the current C standards. With -pedantic, gcc complains:
exec-all.h:344: error: pointer of type ‘void *’ used in arithmetic
Fix this, and also replace (unsigned int) by (uintptr_t) in the same
statement.
Signed-off-by: Stefan Weil <address@hidden>
---
exec-all.h | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/exec-all.h b/exec-all.h
index 69fd5e4..0f10393 100644
--- a/exec-all.h
+++ b/exec-all.h
@@ -358,8 +358,7 @@ static inline tb_page_addr_t get_page_addr_code(CPUState
*env1, target_ulong add
cpu_abort(env1, "Trying to execute code outside RAM or ROM at 0x"
TARGET_FMT_lx "\n", addr);
#endif
}
- p = (void *)(unsigned long)addr
- + env1->tlb_table[mmu_idx][page_index].addend;
+ p = (void *)((uintptr_t)addr +
env1->tlb_table[mmu_idx][page_index].addend);
return qemu_ram_addr_from_host_nofail(p);
}
#endif
--
1.7.2.5
- [Qemu-devel] [PATCH] exec-all: Fix void pointer arithmetic,
Stefan Weil <=