[Nasm-bugs] [Bug 3392720] New: Nested "at" macro usage in an mmacro is not expanded
noreply-nasm at dev.nasm.us
noreply-nasm at dev.nasm.us
Mon Oct 19 08:21:49 PDT 2020
https://bugzilla.nasm.us/show_bug.cgi?id=3392720
Bug ID: 3392720
Summary: Nested "at" macro usage in an mmacro is not expanded
Product: NASM
Version: 2.15.xx
Hardware: All
OS: All
Status: OPEN
Severity: major
Priority: Medium
Component: Assembler
Assignee: nobody at nasm.us
Reporter: pushbx at ulukai.org
CC: chang.seok.bae at intel.com, gorcunov at gmail.com,
hpa at zytor.com, nasm-bugs at nasm.us
Obtained from: Built from git using configure
Using "at" in a multi-line macro that is itself used as the data parameter of
another "at" leaves the inner "at" unexpanded, leading to errors. In the
following, the -DERROR -E run shows ".. at 11.strucstart:" \ "at bar.bar, db 0"
which means the inner "at" wasn't expanded, and is then subsequently passed as
a literal instruction to the assembler.
$ cat test2.asm
struc foo
.foo: resb 1
endstruc
struc bar
.bar: resb 1
endstruc
%macro quux 0
istruc bar
at bar.bar, db 0
iend
%endmacro
istruc foo
%ifdef ERROR
at foo.foo, quux
%else
at foo.foo
quux
%endif
iend
$ nasm test2.asm
$ nasm test2.asm -DERROR
test2.asm:18: error: parser: instruction expected
$ nasm test2.asm -E
%line 2+1 test2.asm
[absolute 0]
%line 2+0 test2.asm
foo:
%line 3+1 test2.asm
.foo: resb 1
foo_size equ ($-foo)
%line 4+0 test2.asm
[section .text]
%line 5+1 test2.asm
[absolute 0]
%line 6+0 test2.asm
bar:
%line 7+1 test2.asm
.bar: resb 1
bar_size equ ($-bar)
%line 8+0 test2.asm
[section .text]
%line 9+1 test2.asm
%line 15+1 test2.asm
.. at 7.strucstart:
%line 20+1 test2.asm
times (foo.foo-foo)-($-.. at 7.strucstart) db 0
%line 20+0 test2.asm
%line 11+0 test2.asm
.. at 11.strucstart:
%line 12+1 test2.asm
times (bar.bar-bar)-($-.. at 11.strucstart) db 0
%line 12+0 test2.asm
db 0
%line 13+1 test2.asm
times bar_size-($-.. at 11.strucstart) db 0
%line 23+1 test2.asm
times foo_size-($-.. at 7.strucstart) db 0
$ nasm test2.asm -DERROR -E
%line 2+1 test2.asm
[absolute 0]
%line 2+0 test2.asm
foo:
%line 3+1 test2.asm
.foo: resb 1
foo_size equ ($-foo)
%line 4+0 test2.asm
[section .text]
%line 5+1 test2.asm
[absolute 0]
%line 6+0 test2.asm
bar:
%line 7+1 test2.asm
.bar: resb 1
bar_size equ ($-bar)
%line 8+0 test2.asm
[section .text]
%line 9+1 test2.asm
%line 15+1 test2.asm
.. at 7.strucstart:
times (foo.foo-foo)-($-.. at 7.strucstart) db 0
%line 18+0 test2.asm
.. at 11.strucstart:
at bar.bar, db 0
times bar_size-($-.. at 11.strucstart) db 0
%line 23+0 test2.asm
times foo_size-($-.. at 7.strucstart) db 0
$ nasm --version
NASM version 2.15.03rc1 compiled on Sep 29 2020
$
--
You are receiving this mail because:
You are watching all bug changes.
You are on the CC list for the bug.
More information about the Nasm-bugs
mailing list