[Nasm-bugs] [Bug 3392489] New: istruc's at parses trailing comma as part of first macro parameter

noreply-nasm at gorcunov.org noreply-nasm at gorcunov.org
Thu May 31 06:35:34 PDT 2018


https://bugzilla.nasm.us/show_bug.cgi?id=3392489

            Bug ID: 3392489
           Summary: istruc's at parses trailing comma as part of first
                    macro parameter
           Product: NASM
           Version: 2.13.xx
          Hardware: All
                OS: All
            Status: OPEN
          Severity: normal
          Priority: Medium
         Component: Assembler
          Assignee: nobody at nasm.us
          Reporter: pushbx at 38.de
                CC: gorcunov at gmail.com, hpa at zytor.com, nasm-bugs at nasm.us
     Obtained from: From OS distribution

Here's the definition of the at macro from
http://repo.or.cz/nasm.git/blob/HEAD:/macros/standard.mac#l109

===
%imacro at 1-2+.nolist
    times (%1-%$strucname)-($-%$strucstart) db 0
    %2
%endmacro
===

Here's my test case:

===
$ nasm -v
NASM version 2.13.02
$ cat test.asm 
        struc EXEHEADER
exeHeaderSizePara:      resw 1
        endstruc

        istruc EXEHEADER
at exeHeaderSizePara,
        iend
$ nasm test.asm 
test.asm:6: error: expecting `)'
$ nasm test.asm -E
%line 1+1 test.asm
[absolute 0]
%line 1+0 test.asm
EXEHEADER:
%line 2+1 test.asm
exeHeaderSizePara: resw 1
EXEHEADER_size equ ($-EXEHEADER)
%line 3+0 test.asm
[section .text]
%line 4+1 test.asm

.. at 4.strucstart:
times (exeHeaderSizePara,-EXEHEADER)-($-.. at 4.strucstart) db 0
%line 6+0 test.asm

%line 7+1 test.asm
times EXEHEADER_size-($-.. at 4.strucstart) db 0
$ 
===

As is visible in the only-preprocessed output, the trailing comma is taken as
belonging to the first macro parameter, resulting in that parameter's expansion
being "exeHeaderSizePara,". I expected it to signify an empty second parameter,
and the comma itself being parsed as the parameter separator.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.


More information about the Nasm-bugs mailing list