NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: gammac on November 27, 2014, 12:33:46 PM

Title: %arg and %local macros are buggy
Post by: gammac on November 27, 2014, 12:33:46 PM
this compiles without any warning:

Code: [Select]
cpu 386

global start


[SECTION .code use32]

start:

push 0x00112233
push 0x44556677
push 0x8899AABB
push 0xCCDDEEFF
call Main
ret

%push
Main:
%stacksize flat

%arg a1:qword
%arg a2:dword
%arg a3:word
%arg a4:byte
%arg a5:byte

push ebp
mov ebp, esp

fild qword [a1]
mov eax, [a2]
mov ax, [a3]
mov al, [a4]
mov ah, [a5]

mov esp, ebp
pop ebp
ret 16
%pop

and produces the following buggy code:

Code: [Select]
fild qword [(ebp+8)]
mov eax, [(ebp+16)]
mov ax, [(ebp+20)]
mov al, [(ebp+24)]
mov ah, [(ebp+28)]


EDIT: same behaviour with %local, word and byte sizes are buggy

tested against the latest stable windows version
Code: [Select]
>nasm -v
NASM version 2.11.06 compiled on Oct 20 2014