[Nasm-bugs] [Bug 3392628] New: %ifnidn triggering for same content under certain circumstances

noreply-nasm at dev.nasm.us noreply-nasm at dev.nasm.us
Sat Oct 26 03:55:49 PDT 2019


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

            Bug ID: 3392628
           Summary: %ifnidn triggering for same content under certain
                    circumstances
           Product: NASM
           Version: 2.15 (development)
          Hardware: All
                OS: All
            Status: OPEN
          Severity: minor
          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

A certain combination of twice defining a variable with %assign, passing that
variable through %xdefine, and then passing one of the variables into a
multi-line macro parameter, results in differing opinions on whether the
variables are the same for %ifnidn, between an old NASM and the newest NASM
(which is
https://repo.or.cz/nasm.git/commitdiff/e91f5cc1322eed4da0de81656276e021bf352c3d
built from git using configure).

$ nasm -v
NASM version 2.15rc0 compiled on Oct 24 2019
$ oldnasm -v
NASM version 2.12.02 compiled on Aug 10 2019
$ cat test4.asm 

%push

%assign ?var -6

 %xdefine %$labellist ?var
%assign ?var -6

        %macro mac5 1-*
%ifnidn %1, %$check
 %warning false 1=%1 check=%$check
%else
 %warning true 1=%1 check=%$check
%endif
        %endmacro

%xdefine %$check ?var
        mac5 %$labellist
%pop
$ echo "nasm:"; nasm test4.asm; echo "oldnasm:"; oldnasm test4.asm 
nasm:
test4.asm:18: warning: true 1=-6 check=-6 [-w+user]
test4.asm:13: ... from macro `mac5' defined here
oldnasm:
test4.asm:18: warning: (mac5:2) false 1=-6 check=-6
test4.asm:11: ... from macro `mac5' defined here
$ 


I already simplified my test case somewhat, originally it was the conditional
at https://hg.ulukai.org/ecm/lmacros/file/67a2ee517d8e/lmacros2.mac#l666 which
failed in test case 015 on older NASM.

Here's a workaround that I will apply to my macro package to support older NASM
versions:


$ cat test5.asm 

%push

%assign ?var -6

 %xdefine %$labellist ?var
%assign ?var -6

        %macro mac5 1-*
%ifnidn %1, %$check
 %ifnnum %1
  %warning false 1=%1 check=%$check
 %elifnnum %$check
  %warning false 1=%1 check=%$check
 %elifn %1 == %$check
  %warning false 1=%1 check=%$check
 %else
 %warning true2 1=%1 check=%$check
 %endif
%else
 %warning true1 1=%1 check=%$check
%endif
        %endmacro

%xdefine %$check ?var
        mac5 %$labellist
%pop
$ echo "nasm:"; nasm test5.asm; echo "oldnasm:"; oldnasm test5.asm 
nasm:
test5.asm:26: warning: true1 1=-6 check=-6 [-w+user]
test5.asm:21: ... from macro `mac5' defined here
oldnasm:
test5.asm:26: warning: (mac5:9) true2 1=-6 check=-6
test5.asm:18: ... from macro `mac5' defined here
$ 


Here's another test case which fails for both versions of NASM. I consider this
as an error, which applies to both versions.


$ cat test6.asm

%push
%assign ?var -6

        %macro mac5 1-*
%ifnidn %1, %$check
 %warning false 1=%1 check=%$check
%else
 %warning true 1=%1 check=%$check
%endif
        %endmacro

%xdefine %$check ?var
        mac5 -6
%pop
$ echo "nasm:"; nasm test6.asm; echo "oldnasm:"; oldnasm test6.asm 
nasm:
test6.asm:14: warning: false 1=-6 check=-6 [-w+user]
test6.asm:7: ... from macro `mac5' defined here
oldnasm:
test6.asm:14: warning: (mac5:2) false 1=-6 check=-6
test6.asm:7: ... from macro `mac5' defined here
$

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