Patchwork declare saved_env_reg as volatile

login
register
mail settings
Submitter Paolo Bonzini
Date Feb. 23, 2010, 6:21 p.m.
Message ID <1266949260-24974-1-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/46085/
State New
Headers show

Comments

Paolo Bonzini - Feb. 23, 2010, 6:21 p.m.
This ensures that the compiler does not move it away from
the "env = env1;" assignment.  Fixes a miscompilation
on gcc 4.4, reported by Jay Foad.

Cc: <jay.foad@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 cpu-exec.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/cpu-exec.c b/cpu-exec.c
index 51aa416..8721684 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -215,7 +215,7 @@  static void cpu_handle_debug_exception(CPUState *env)
 
 int cpu_exec(CPUState *env1)
 {
-    host_reg_t saved_env_reg;
+    volatile host_reg_t saved_env_reg;
     int ret, interrupt_request;
     TranslationBlock *tb;
     uint8_t *tc_ptr;