]> Git Repo - qemu.git/commitdiff
exec-all: Fix void pointer arithmetic
authorStefan Weil <[email protected]>
Sun, 23 Oct 2011 06:19:10 +0000 (08:19 +0200)
committerBlue Swirl <[email protected]>
Sun, 30 Oct 2011 09:05:00 +0000 (09:05 +0000)
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 long) by (uintptr_t) in the same
statement.

Signed-off-by: Stefan Weil <[email protected]>
Signed-off-by: Blue Swirl <[email protected]>
exec-all.h

index 72ef24679345c73d42c5ec3e6fbe8a36c373c592..85a37bf1ed3e01561189bae0acb8d8b491f1cc67 100644 (file)
@@ -340,8 +340,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
This page took 0.027256 seconds and 4 git commands to generate.