From 36527d39036ab71b7250320b4aeb32d00a8b97ad Mon Sep 17 00:00:00 2001 From: Ali Gholami Rudi Date: Mon, 12 Jul 2010 20:22:59 +0430 Subject: [PATCH] gen: ignore the sign of the second operand in / and % --- gen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gen.c b/gen.c index 07d4d24..8332205 100644 --- a/gen.c +++ b/gen.c @@ -591,7 +591,8 @@ static int mulop(int uop, int sop, int reg) { struct tmp *t1 = TMP(0); struct tmp *t2 = TMP(1); - int bt = bt_op(t1->bt, t2->bt); + /* for div and mod, the sign of the second operand don't matter */ + int bt = uop == 4 ? bt_op(t1->bt, t2->bt) : TMPBT(t2->bt); if (t1->flags & LOC_REG && t1->addr != R_EAX && t1->addr != R_EDX) reg = t1->addr; tmp_to(t1, reg, bt); -- 2.11.4.GIT