summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2016-10-03 22:18:31 -0700
committerH. Peter Anvin <hpa@zytor.com>2016-10-03 22:18:31 -0700
commitc5d40b35761c8e7c4ab4503ec4d05d05d4cbb277 (patch)
tree79621bd79c6ca53749118ef7a17d8df3c6b4e9a9
parent976ba730622ae7c2d5e88d4fb4477ff96c1cd3f4 (diff)
downloadnasm-c5d40b35761c8e7c4ab4503ec4d05d05d4cbb277.tar.gz
assemble: print a warning on a forward reference in RESx
Print a warning on a forward reference in RESx. This really should have been a critical expression, and a forward reference should have been an error, but it wasn't implemented that way and as such we can't just randomly break people's code, even if it is dangerous.
-rw-r--r--assemble.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/assemble.c b/assemble.c
index 4c8415fd..a1aef1cd 100644
--- a/assemble.c
+++ b/assemble.c
@@ -1178,6 +1178,9 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits,
if (ins->oprs[0].segment != NO_SEG)
nasm_error(ERR_NONFATAL, "attempt to reserve non-constant"
" quantity of BSS space");
+ else if (ins->oprs[0].opflags & OPFLAG_FORWARD)
+ nasm_error(ERR_WARNING | ERR_PASS1,
+ "forward reference in RESx can result in unpredictable results");
else
length += ins->oprs[0].offset;
break;