From 46c26f12a7c2f12deb64df0088f8111acc5d2d62 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Thu, 3 Oct 2002 07:38:15 +0000 Subject: [PATCH] Fix incorrect invalidation of [eax+ebx+ecx-eax] and others like it. svn path=/trunk/yasm/; revision=725 --- modules/arch/x86/x86expr.c | 4 ++-- src/arch/x86/x86expr.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/arch/x86/x86expr.c b/modules/arch/x86/x86expr.c index 04417d30..9855a087 100644 --- a/modules/arch/x86/x86expr.c +++ b/modules/arch/x86/x86expr.c @@ -293,7 +293,7 @@ x86_expr_checkea_getregusage(expr **ep, /*@null@*/ int *indexreg, void *data, return 0; (*reg) += intnum_get_int(e->terms[i].data.expn->terms[1].data.intn); - if (indexreg) + if (indexreg && *reg > 0) *indexreg = reg-(int *)data; } } @@ -563,7 +563,7 @@ x86_expr_checkea(expr **ep, unsigned char *addrsize, unsigned char bits, ErrorAt(e->line, _("invalid effective address")); return 0; } - if (i != indexreg && reg32mult[i] == 1) + if (i != indexreg && reg32mult[i] == 1 && basereg == REG32_NONE) basereg = i; else if (indexreg == REG32_NONE && reg32mult[i] > 0) indexreg = i; diff --git a/src/arch/x86/x86expr.c b/src/arch/x86/x86expr.c index 04417d30..9855a087 100644 --- a/src/arch/x86/x86expr.c +++ b/src/arch/x86/x86expr.c @@ -293,7 +293,7 @@ x86_expr_checkea_getregusage(expr **ep, /*@null@*/ int *indexreg, void *data, return 0; (*reg) += intnum_get_int(e->terms[i].data.expn->terms[1].data.intn); - if (indexreg) + if (indexreg && *reg > 0) *indexreg = reg-(int *)data; } } @@ -563,7 +563,7 @@ x86_expr_checkea(expr **ep, unsigned char *addrsize, unsigned char bits, ErrorAt(e->line, _("invalid effective address")); return 0; } - if (i != indexreg && reg32mult[i] == 1) + if (i != indexreg && reg32mult[i] == 1 && basereg == REG32_NONE) basereg = i; else if (indexreg == REG32_NONE && reg32mult[i] > 0) indexreg = i; -- 2.40.0