Skip to content

Commit

Permalink
assemble: print a warning on a forward reference in RESx
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
H. Peter Anvin committed Oct 4, 2016
1 parent 976ba73 commit c5d40b3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions assemble.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c5d40b3

Please sign in to comment.