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.
This commit is contained in:
H. Peter Anvin 2016-10-03 22:18:31 -07:00
parent 976ba73062
commit c5d40b3576

View file

@ -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;