[Nasm-bugs] [Bug 3392602] git nasm: segmentation fault when assembling lmacros tests

noreply-nasm at gorcunov.org noreply-nasm at gorcunov.org
Tue Aug 20 05:10:02 PDT 2019


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

--- Comment #9 from C. Masloch <pushbx at 38.de> ---
I did a few more tests with three different NASM versions. The good news is
that all of them are consistent and my original source just works. However, it
seems to be slower than the alternative, which is using 2-* for the macro
parameters and disabling the macro-params (later macro-params-multi) warning:

$ cat test.asm
%ifdef P2
                ; Call with word parameters behind opcode
        %imacro call 2-*.nolist
                %? %1
%rep %0 - 1
%rotate 1
                dw %1
%endrep
        %endmacro
%warning p2
%else
                ; Call with word parameters behind opcode
        %imacro call 1-*.nolist
                %? %1
%rep %0 - 1
%rotate 1
                dw %1
%endrep
        %endmacro
%warning p1
%endif

%ifndef REPEAT
 %assign REPEAT 100_000
%endif


        cpu 386
        bits 32
        org 0

%rep REPEAT
        call alpha
        call beta
        call gamma
        call delta
%endrep

alpha:
        nop
        nop
        nop
beta:
        nop
        nop
        nop
gamma:
        nop
        nop
        nop
delta:
        nop
        nop
        nop

$ oldnasm -v
NASM version 2.15rc0 compiled on Dec 28 2018
$ time oldnasm test.asm -Wno-macro-params -DP2
test.asm:10: warning: p2 [-w+user]

real    0m2.429s
user    0m2.406s
sys     0m0.008s
$ time oldnasm test.asm -Wno-macro-params
test.asm:20: warning: p1 [-w+user]

real    0m9.497s
user    0m7.906s
sys     0m0.802s
$ time oldnasm test.asm -DREPEAT=1 -DP2
test.asm:10: warning: p2 [-w+user]
test.asm:37: warning: macro `call' exists, but not taking 1 parameters
[-w+macro-params]
test.asm:37: warning: macro `call' exists, but not taking 1 parameters
[-w+macro-params]
test.asm:37: warning: macro `call' exists, but not taking 1 parameters
[-w+macro-params]
test.asm:37: warning: macro `call' exists, but not taking 1 parameters
[-w+macro-params]

real    0m0.006s
user    0m0.002s
sys     0m0.003s
$ time oldnasm test.asm -DREPEAT=1
test.asm:20: warning: p1 [-w+user]

real    0m0.012s
user    0m0.003s
sys     0m0.002s
$ /usr/bin/nasm -v
NASM version 2.12.01
$ time /usr/bin/nasm test.asm -Wno-macro-params -DP2

real    0m2.238s
user    0m2.225s
sys     0m0.007s
$ time /usr/bin/nasm test.asm -Wno-macro-params

real    0m6.745s
user    0m6.726s
sys     0m0.005s
$ time /usr/bin/nasm test.asm -DREPEAT=1 -DP2
test.asm:37: warning: macro `call' exists, but not taking 1 parameters
test.asm:37: warning: macro `call' exists, but not taking 1 parameters
test.asm:37: warning: macro `call' exists, but not taking 1 parameters
test.asm:37: warning: macro `call' exists, but not taking 1 parameters

real    0m0.006s
user    0m0.001s
sys     0m0.005s
$ time /usr/bin/nasm test.asm -DREPEAT=1

real    0m0.004s
user    0m0.001s
sys     0m0.003s
$ nasm -v
NASM version 2.15rc0 compiled on Aug 20 2019
$ time nasm test.asm -Wno-macro-params -DP2
test.asm:10: warning: p2 [-w+user]

real    0m2.520s
user    0m2.510s
sys     0m0.006s
$ time nasm test.asm -Wno-macro-params
test.asm:20: warning: p1 [-w+user]

real    0m14.976s
user    0m9.204s
sys     0m1.168s
$ time nasm test.asm -DREPEAT=1 -DP2
test.asm:10: warning: p2 [-w+user]
test.asm:37: warning: multi-line macro `call' exists, but not taking 1
parameter [-w+macro-params-multi]
test.asm:37: warning: multi-line macro `call' exists, but not taking 1
parameter [-w+macro-params-multi]
test.asm:37: warning: multi-line macro `call' exists, but not taking 1
parameter [-w+macro-params-multi]
test.asm:37: warning: multi-line macro `call' exists, but not taking 1
parameter [-w+macro-params-multi]

real    0m0.006s
user    0m0.002s
sys     0m0.003s
$ time nasm test.asm -DREPEAT=1
test.asm:20: warning: p1 [-w+user]

real    0m0.004s
user    0m0.001s
sys     0m0.002s
$

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