diff options
author | H. Peter Anvin <hpa@zytor.com> | 2016-10-03 22:18:31 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2016-10-03 22:18:31 -0700 |
commit | c5d40b35761c8e7c4ab4503ec4d05d05d4cbb277 (patch) | |
tree | 79621bd79c6ca53749118ef7a17d8df3c6b4e9a9 | |
parent | 976ba730622ae7c2d5e88d4fb4477ff96c1cd3f4 (diff) | |
download | nasm-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.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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; |