NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: nobody on August 21, 2007, 07:12:21 PM

Title: Macro parameters
Post by: nobody on August 21, 2007, 07:12:21 PM
Is there a limitation of 15 parameters allowed by NASM when
invoking a MACRO ?
NASM crashes during compile with this code :

%macro testmacro 16

%rep %0
     mov eax,dword [%1]
%rotate 1
%endrep

%endmacro

;----------------------------
[section .text]

testmacro var,var,var,var,var,var,var,var,\
          var,var,var,var,var,var,var,var
;---------------------------
[section .data]
var dd 4


It works up to and including 15 parameters but I can't find any
mention of a limiting number of parameters in the NASM docs.
If the macro is NOT called then NASM doesn't throw any error msgs.
The crash happens when it tries to expand the code.

Thanks in advance for any help
Austin
Title: Re: Macro parameters
Post by: nobody on August 21, 2007, 07:59:22 PM
Not intentional, but I think there *is* a bug with 16 parameters, exactly. More than 16 may or may not work (haven't tested it). I think there's something about it on the bug-tracker (haven't checked that, either). I'll look into it. Thanks for the feedback, Austin.

Best,
Frank
Title: Re: Macro parameters
Post by: mcamember on August 21, 2007, 09:06:45 PM
Hi Frank,
You're right. The stumbling block is 16 and its multiples
(17-31 is o.k. but 32 fails.)
Thanks again,
Austin
Title: Re: Macro parameters
Post by: nobody on August 24, 2007, 05:05:57 AM
See SF bug #1284169.