[Nasm-bugs] [Bug 3392598] New: Empty define within %[...] evaluates to a blank instead of empty string

noreply-nasm at gorcunov.org noreply-nasm at gorcunov.org
Sat Aug 10 01:44:36 PDT 2019


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

            Bug ID: 3392598
           Summary: Empty define within %[...] evaluates to a blank
                    instead of empty string
           Product: NASM
           Version: 2.15 (development)
          Hardware: All
                OS: All
            Status: OPEN
          Severity: normal
          Priority: Medium
         Component: Assembler
          Assignee: nobody at nasm.us
          Reporter: pushbx at 38.de
                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, From OS distribution

I expected the %[...] construct to give an empty string when the single-line
macro within it is defined as empty, and thus paste the tokens before and after
the %[...], but that doesn't happen. I have to work around this using %+.

$ nasm -v
NASM version 2.14.02
$ cat test.asm
%define _DEB_ASM_PREFIX

%ifdef CASE1
.. at symhint_skip_caller_asciz_%[_DEB_ASM_PREFIX]d4message:
%endif
%ifdef CASE2
.. at symhint_skip_caller_asciz_ %+ %[_DEB_ASM_PREFIX] %+ d4message.2:
%endif

%define _DEB_ASM_PREFIX init_

%ifdef CASE3
.. at symhint_skip_caller_asciz_%[_DEB_ASM_PREFIX]d4message:
%endif
%ifdef CASE4
.. at symhint_skip_caller_asciz_ %+ %[_DEB_ASM_PREFIX] %+ d4message.2:
%endif
$ nasm -DCASE1 -DCASE2 -DCASE3 -DCASE4 test.asm -o test -E && cat test
%line 2+1 test.asm


.. at symhint_skip_caller_asciz_ d4message:
%line 7+1 test.asm
.. at symhint_skip_caller_asciz_d4message.2:





.. at symhint_skip_caller_asciz_init_d4message:
%line 16+1 test.asm
.. at symhint_skip_caller_asciz_init_d4message.2:
$ nasm -DCASE2 -DCASE3 -DCASE4 test.asm -o test
$ nasm -DCASE1 test.asm -o test
test.asm:4: error: parser: instruction expected
$ newnasm -v
NASM version 2.15rc0 compiled on Aug 10 2019
$ newnasm -DCASE1 -DCASE2 -DCASE3 -DCASE4 test.asm -o test -E && cat test
%line 2+1 test.asm


.. at symhint_skip_caller_asciz_ d4message:
%line 7+1 test.asm
.. at symhint_skip_caller_asciz_d4message.2:





.. at symhint_skip_caller_asciz_init_d4message:
%line 16+1 test.asm
.. at symhint_skip_caller_asciz_init_d4message.2:
$ newnasm -DCASE2 -DCASE3 -DCASE4 test.asm -o test
$ newnasm -DCASE1 test.asm -o test
test.asm:4: error: parser: instruction expected
$

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