aboutsummaryrefslogtreecommitdiff
path: root/target-i386
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2015-09-29 17:34:23 -0300
committerEduardo Habkost <ehabkost@redhat.com>2015-10-27 15:52:11 -0200
commit712b4243c761cb6ab6a4367a160fd2a42e2d4b76 (patch)
tree2ac1a7b6ebaeb5c6124e46ba06ea13cdc9a95749 /target-i386
parent7e038b94e74e1c2d1b3598e2e4b0b5c8b79a7278 (diff)
downloadqemu-712b4243c761cb6ab6a4367a160fd2a42e2d4b76.zip
qemu-712b4243c761cb6ab6a4367a160fd2a42e2d4b76.tar.gz
qemu-712b4243c761cb6ab6a4367a160fd2a42e2d4b76.tar.bz2
target-i386: Don't left shift negative constant
Left shift of negative values is undefined behavior. Detected by clang: qemu/target-i386/translate.c:2423:26: runtime error: left shift of negative value -8 This changes the code to reverse the sign after the left shift. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'target-i386')
-rw-r--r--target-i386/translate.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/target-i386/translate.c b/target-i386/translate.c
index 764b1e4..862f8e0 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -2432,7 +2432,7 @@ static void gen_pusha(DisasContext *s)
{
int i;
gen_op_movl_A0_reg(R_ESP);
- gen_op_addl_A0_im(-8 << s->dflag);
+ gen_op_addl_A0_im(-(8 << s->dflag));
if (!s->ss32)
tcg_gen_ext16u_tl(cpu_A0, cpu_A0);
tcg_gen_mov_tl(cpu_T[1], cpu_A0);