From 04177a59b47ce4c509f1c0046a8a8ba4b06decd9 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sun, 19 Oct 2003 18:38:03 +0000 Subject: [PATCH] Remove obsolete overflow check in EA displacements (causing error instead of warning on size overflow). Bugzilla Bug 18 Reported by Jeff Lawson svn path=/trunk/yasm/; revision=1071 --- modules/arch/x86/tests/Makefile.inc | 3 +++ modules/arch/x86/tests/ea-over.asm | 4 ++++ modules/arch/x86/tests/ea-over.errwarn | 1 + modules/arch/x86/tests/ea-over.hex | 6 ++++++ modules/arch/x86/x86expr.c | 12 ------------ 5 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 modules/arch/x86/tests/ea-over.asm create mode 100644 modules/arch/x86/tests/ea-over.errwarn create mode 100644 modules/arch/x86/tests/ea-over.hex diff --git a/modules/arch/x86/tests/Makefile.inc b/modules/arch/x86/tests/Makefile.inc index 0aae20c5..24f4dd68 100644 --- a/modules/arch/x86/tests/Makefile.inc +++ b/modules/arch/x86/tests/Makefile.inc @@ -18,6 +18,9 @@ EXTRA_DIST += modules/arch/x86/tests/cpubasic-err.asm EXTRA_DIST += modules/arch/x86/tests/cpubasic-err.errwarn EXTRA_DIST += modules/arch/x86/tests/div-err.asm EXTRA_DIST += modules/arch/x86/tests/div-err.errwarn +EXTRA_DIST += modules/arch/x86/tests/ea-over.asm +EXTRA_DIST += modules/arch/x86/tests/ea-over.errwarn +EXTRA_DIST += modules/arch/x86/tests/ea-over.hex EXTRA_DIST += modules/arch/x86/tests/effaddr.asm EXTRA_DIST += modules/arch/x86/tests/effaddr.errwarn EXTRA_DIST += modules/arch/x86/tests/effaddr.hex diff --git a/modules/arch/x86/tests/ea-over.asm b/modules/arch/x86/tests/ea-over.asm new file mode 100644 index 00000000..13185717 --- /dev/null +++ b/modules/arch/x86/tests/ea-over.asm @@ -0,0 +1,4 @@ +[bits 32] +%define P 0xB7E15163 +%define Q 0x9E3779B9 +lea eax,[eax+P+Q] diff --git a/modules/arch/x86/tests/ea-over.errwarn b/modules/arch/x86/tests/ea-over.errwarn new file mode 100644 index 00000000..6a622a99 --- /dev/null +++ b/modules/arch/x86/tests/ea-over.errwarn @@ -0,0 +1 @@ +-:4: warning: value does not fit in 32 bit field diff --git a/modules/arch/x86/tests/ea-over.hex b/modules/arch/x86/tests/ea-over.hex new file mode 100644 index 00000000..7a32106c --- /dev/null +++ b/modules/arch/x86/tests/ea-over.hex @@ -0,0 +1,6 @@ +8d +80 +1c +cb +18 +56 diff --git a/modules/arch/x86/x86expr.c b/modules/arch/x86/x86expr.c index aafcd5f7..5c917537 100644 --- a/modules/arch/x86/x86expr.c +++ b/modules/arch/x86/x86expr.c @@ -438,15 +438,6 @@ x86_checkea_calc_displen(yasm_expr **ep, unsigned int wordsize, int noreg, break; } - /* make sure the displacement will fit in 16/32 bits if unsigned, - * and 8 bits if signed. - */ - if (!yasm_intnum_check_size(intn, (size_t)wordsize*8, 0, 0) && - !yasm_intnum_check_size(intn, 8, 0, 1)) { - yasm__error(e->line, N_("invalid effective address")); - return 1; - } - /* don't try to find out what size displacement we have if * displen is known. */ @@ -459,9 +450,6 @@ x86_checkea_calc_displen(yasm_expr **ep, unsigned int wordsize, int noreg, break; } - /* Don't worry about overflows here (it's already guaranteed - * to be 16/32 or 8 bits). - */ dispval = yasm_intnum_get_int(intn); /* Figure out what size displacement we will have. */ -- 2.40.0