From e500c9118a49a8ce0e9b8cee87bb1329adfe1af9 Mon Sep 17 00:00:00 2001 From: grischka Date: Sun, 6 Dec 2009 17:41:22 +0100 Subject: [PATCH] i386-asm: fix imul With imul the 3rd operand defaults to the 2nd on. The previous logic left 'op_type[2]' uninitialized which caused the bug to show up only sometimes. --- i386-asm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/i386-asm.c b/i386-asm.c index 4b1dd8f..b18a4bc 100644 --- a/i386-asm.c +++ b/i386-asm.c @@ -676,10 +676,11 @@ static void asm_opcode(TCCState *s1, int opcode) g(seg_prefix); v = pa->opcode; - if (v == 0x69 || v == 0x69) { + if ((v == 0x69 || v == 0x6b) && nb_ops == 2) { /* kludge for imul $im, %reg */ nb_ops = 3; ops[2] = ops[1]; + op_type[2] = op_type[1]; } else if (v == 0xcd && ops[0].e.v == 3 && !ops[0].e.sym) { v--; /* int $3 case */ nb_ops = 0;