summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-10-04 18:50:47 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-10-04 18:50:47 -0700
commit6c80ab6f7f3a5d18076f9b2edbce89d8f80247cd (patch)
treefb31c6c32c09f4fff2d5334aff9b5796ddacdfdd
parentece980c38bc5d7a4d76ccdb3aa70e2e811a6b2af (diff)
downloadnasm-6c80ab6f7f3a5d18076f9b2edbce89d8f80247cd.tar.gz
assemble.c: do not warn on valid SBYTE optimizations
Do not warn on valid SBYTE optimizations. If we are optimizing and match one of the SBYTE conditions, do not error out. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--assemble.c12
-rw-r--r--doc/changes.src3
2 files changed, 11 insertions, 4 deletions
diff --git a/assemble.c b/assemble.c
index 5d926a2c..bc41e026 100644
--- a/assemble.c
+++ b/assemble.c
@@ -1255,12 +1255,16 @@ static void gencode(int32_t segment, int64_t offset, int bits,
case 015:
case 016:
case 017:
- /* XXX: warns for legitimate optimizer actions */
- if (opx->offset < -128 || opx->offset > 127) {
+ /* The test for BITS8 and SBYTE here is intended to avoid
+ warning on optimizer actions due to SBYTE, while still
+ warn on explicit BYTE directives. Also warn, obviously,
+ if the optimizer isn't enabled. */
+ if (((opx->type & BITS8) ||
+ !(opx->type & (SBYTE16|SBYTE32|SBYTE64))) &&
+ (opx->offset < -128 || opx->offset > 127)) {
errfunc(ERR_WARNING | ERR_WARN_NOV,
"signed byte value exceeds bounds");
- }
-
+ }
if (opx->segment != NO_SEG) {
data = opx->offset;
out(offset, segment, &data, OUT_ADDRESS, 1,
diff --git a/doc/changes.src b/doc/changes.src
index c0eeddcd..352bbd63 100644
--- a/doc/changes.src
+++ b/doc/changes.src
@@ -25,6 +25,9 @@ since 2007.
\b Fix \c{%include} inside multi-line macros or loops.
+\b Fix error where NASM would generate a spurious warning on valid
+ optimizations of immediate values.
+
\S{cl-2.04} Version 2.04