diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-10-06 23:47:58 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-10-06 23:49:01 -0700 |
commit | 98a22a65c0ad3fe4c615c54c3fcae4c2812a4c0b (patch) | |
tree | 03c99fb1fad04758b83a7599cfde785b91d77dda | |
parent | c1377e9a98dd5ca6f7900c048df5d346d1733d05 (diff) | |
download | nasm-98a22a65c0ad3fe4c615c54c3fcae4c2812a4c0b.tar.gz nasm-98a22a65c0ad3fe4c615c54c3fcae4c2812a4c0b.tar.bz2 nasm-98a22a65c0ad3fe4c615c54c3fcae4c2812a4c0b.zip |
Avoid double warning for signed dword immediate
Avoid double warning for the case where a signed dword immediate is
incorrectly extended to 64 bits.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | assemble.c | 8 | ||||
-rw-r--r-- | test/immwarn.asm | 2 |
2 files changed, 5 insertions, 5 deletions
@@ -775,7 +775,7 @@ static bool is_sbyte32(operand *o) /* check that opn[op] is a signed byte of size 32; warn if this is not the original value when extended to 64 bits */ -static bool is_sbyte64(operand *o) +static bool is_sbyte64(operand *o, bool warn) { int64_t v64; int32_t v; @@ -786,7 +786,7 @@ static bool is_sbyte64(operand *o) v64 = o->offset; v = (int32_t)v64; - if (v64 != v) + if (warn && v64 != v) errfunc(ERR_WARNING | ERR_PASS2 | ERR_WARN_NOV, "signed dword immediate exceeds bounds"); @@ -974,7 +974,7 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits, case 0251: case 0252: case 0253: - length += is_sbyte64(opx) ? 1 : 4; + length += is_sbyte64(opx, false) ? 1 : 4; break; case 0260: case 0261: @@ -1599,7 +1599,7 @@ static void gencode(int32_t segment, int64_t offset, int bits, case 0253: data = opx->offset; warn_overflow(4, opx); - if (is_sbyte64(opx)) { + if (is_sbyte64(opx, true)) { bytes[0] = data; out(offset, segment, bytes, OUT_RAWDATA, 1, NO_SEG, NO_SEG); diff --git a/test/immwarn.asm b/test/immwarn.asm index 4b67676..24119a2 100644 --- a/test/immwarn.asm +++ b/test/immwarn.asm @@ -74,7 +74,7 @@ %endif add rcx,0FFFFh %if WARN - add rcx,0FFFFFFFFh ; XXX - double + add rcx,0FFFFFFFFh %endif add rcx,-1 |