aboutsummaryrefslogtreecommitdiff
path: root/i386-asm.c
diff options
context:
space:
mode:
authorgrischka <grischka>2009-12-06 17:41:22 +0100
committergrischka <grischka>2009-12-06 17:41:22 +0100
commite500c9118a49a8ce0e9b8cee87bb1329adfe1af9 (patch)
tree7ce9950f0b32a432f62ca241959266bb3dad2f99 /i386-asm.c
parent56d6abdb3dfa6dd51934164969123c07296ef6af (diff)
downloadtinycc-e500c9118a49a8ce0e9b8cee87bb1329adfe1af9.tar.gz
tinycc-e500c9118a49a8ce0e9b8cee87bb1329adfe1af9.tar.bz2
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.
Diffstat (limited to 'i386-asm.c')
-rw-r--r--i386-asm.c3
1 files changed, 2 insertions, 1 deletions
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;