diff mbox series

[4/6] contrib/plugins/hotblocks: fix warning when compiling on 32bits host

Message ID 20240814233645.944327-5-pierrick.bouvier@linaro.org
State New
Headers show
Series build contrib/plugins using meson | expand

Commit Message

Pierrick Bouvier Aug. 14, 2024, 11:36 p.m. UTC
Found on debian stable (i386).

../contrib/plugins/hotblocks.c: In function 'vcpu_tb_trans':
../contrib/plugins/hotblocks.c:117:56: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
  117 |     cnt = (ExecCount *) g_hash_table_lookup(hotblocks, (gconstpointer) hash);
      |                                                        ^
../contrib/plugins/hotblocks.c:126:40: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
  126 |         g_hash_table_insert(hotblocks, (gpointer) hash, (gpointer) cnt);
      |

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 contrib/plugins/hotblocks.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Thomas Huth Aug. 15, 2024, 8:14 a.m. UTC | #1
On 15/08/2024 01.36, Pierrick Bouvier wrote:
> Found on debian stable (i386).
> 
> ../contrib/plugins/hotblocks.c: In function 'vcpu_tb_trans':
> ../contrib/plugins/hotblocks.c:117:56: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>    117 |     cnt = (ExecCount *) g_hash_table_lookup(hotblocks, (gconstpointer) hash);
>        |                                                        ^
> ../contrib/plugins/hotblocks.c:126:40: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>    126 |         g_hash_table_insert(hotblocks, (gpointer) hash, (gpointer) cnt);
>        |
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   contrib/plugins/hotblocks.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c
> index 02bc5078bdd..d540f1b7f0b 100644
> --- a/contrib/plugins/hotblocks.c
> +++ b/contrib/plugins/hotblocks.c
> @@ -109,9 +109,9 @@ static void vcpu_tb_exec(unsigned int cpu_index, void *udata)
>   static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
>   {
>       ExecCount *cnt;
> -    uint64_t pc = qemu_plugin_tb_vaddr(tb);
> +    uintptr_t pc = qemu_plugin_tb_vaddr(tb);

qemu_plugin_tb_vaddr() return uint64_t, so this looks wrong to me, too.

  Thomas
diff mbox series

Patch

diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c
index 02bc5078bdd..d540f1b7f0b 100644
--- a/contrib/plugins/hotblocks.c
+++ b/contrib/plugins/hotblocks.c
@@ -109,9 +109,9 @@  static void vcpu_tb_exec(unsigned int cpu_index, void *udata)
 static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
 {
     ExecCount *cnt;
-    uint64_t pc = qemu_plugin_tb_vaddr(tb);
+    uintptr_t pc = qemu_plugin_tb_vaddr(tb);
     size_t insns = qemu_plugin_tb_n_insns(tb);
-    uint64_t hash = pc ^ insns;
+    uintptr_t hash = pc ^ insns;
 
     g_mutex_lock(&lock);
     cnt = (ExecCount *) g_hash_table_lookup(hotblocks, (gconstpointer) hash);