#500 divide-by-zero error with forward reference in "equ"

open
nobody
Assembler (85)
4
2010-09-06
2010-09-06
Frank Kotler
No

As reported by Madanra on the forum...

%define sector(b) ((b-$$)>>9)
spt equ sector(dataend)
dd 32/spt
times 4088 db 0
dataend:

This results in a divide-by-zero error. The argument to "equ" is a critical expression. In two-pass mode, this results in "'dataend' not defined before use". With extra passes, the evaluation can be deferred, but is apparently temporarily evaluated as zero on the first pass. No problem... unless we divide by it!

This behavior has been around for a long time, and is only now being reported as a problem - I guess we don't divide by it much - not high priority. See the forum post for more details:

http://forum.nasm.us/index.php?topic=885.0

Best,
Frank

Discussion