diff mbox

user-exec: alpha-host: Add type cast to avoid compiling warning

Message ID COL130-W82C617DDFCB341FF1DABF4B97E0@phx.gbl
State New
Headers show

Commit Message

Chen Gang Aug. 12, 2015, 5:58 a.m. UTC
The related building warnings in alpha virtual machine:

    CC    i386-linux-user/user-exec.o
  user-exec.c: In function 'cpu_x86_signal_handler':
  user-exec.c:363:20: error: initialization makes pointer from integer without a cast [-Werror=int-conversion]
       uint32_t *pc = uc->uc_mcontext.sc_pc;
                      ^
  user-exec.c:383:30: error: passing argument 1 of 'handle_cpu_signal' makes integer from pointer without a cast [-Werror=int-conversion]
       return handle_cpu_signal(pc, (unsigned long)info->si_addr,
                                ^
  user-exec.c:86:19: note: expected 'uintptr_t {aka long unsigned int}' but argument is of type 'uint32_t * {aka unsigned int *}'
   static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
                     ^

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 user-exec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
1.9.1
diff mbox

Patch

diff --git a/user-exec.c b/user-exec.c
index ed9a07f..baaeb09 100644
--- a/user-exec.c
+++ b/user-exec.c
@@ -360,7 +360,7 @@  int cpu_signal_handler(int host_signum, void *pinfo,
 {
     siginfo_t *info = pinfo;
     struct ucontext *uc = puc;
-    uint32_t *pc = uc->uc_mcontext.sc_pc;
+    uint32_t *pc = (uint32_t *)uc->uc_mcontext.sc_pc;
     uint32_t insn = *pc;
     int is_write = 0;

@@ -380,7 +380,7 @@  int cpu_signal_handler(int host_signum, void *pinfo,
         is_write = 1;
     }

-    return handle_cpu_signal(pc, (unsigned long)info->si_addr,
+    return handle_cpu_signal((unsigned long)pc, (unsigned long)info->si_addr,
                              is_write, &uc->uc_sigmask, puc);
 }
 #elif defined(__sparc__)