aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2019-09-12 18:20:07 -0700
committerH. Peter Anvin <hpa@zytor.com>2019-09-12 18:20:07 -0700
commit86b2e93081072a5c0032eba7d0008948ca5cae75 (patch)
tree23570e4f22495d93a34323a0a8ae78fa24256858
parent82c5cb170453482095b7610e175a07bea1338f50 (diff)
downloadnasm-86b2e93081072a5c0032eba7d0008948ca5cae75.tar.gz
nasm-86b2e93081072a5c0032eba7d0008948ca5cae75.tar.xz
nasm-86b2e93081072a5c0032eba7d0008948ca5cae75.zip
assemble: fix too aggressive dropping of overflow warnings
Drop down to OUT_WRAP when the size is big enough, as opposed to not doing any tests at all. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
-rw-r--r--asm/assemble.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/asm/assemble.c b/asm/assemble.c
index a3752b47..875a0d32 100644
--- a/asm/assemble.c
+++ b/asm/assemble.c
@@ -376,8 +376,9 @@ static void out(struct out_data *data)
amax = ofmt->maxbits >> 3; /* Maximum address size in bytes */
if ((ofmt->flags & OFMT_KEEP_ADDR) == 0 && data->tsegment == fixseg &&
data->twrt == NO_SEG) {
- if (asize < (size_t)(data->bits >> 3))
- warn_overflow_out(addrval, asize, data->sign);
+ if (asize >= (size_t)(data->bits >> 3))
+ data->sign = OUT_WRAP; /* Support address space wrapping for low-bit modes */
+ warn_overflow_out(addrval, asize, data->sign);
xdata.q = cpu_to_le64(addrval);
data->data = xdata.b;
data->type = OUT_RAWDATA;