NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: cm on September 06, 2010, 02:53:51 PM

Title: %deftok bug or wrong expectation?
Post by: cm on September 06, 2010, 02:53:51 PM
Assembling this file:
Code: [Select]

%define foo "near bar"
%deftok foo_tok foo

%warning Foo = foo, Foo_tok = foo_tok

NASM outputs this:
Code: [Select]
tok.asm:5: warning: Foo = "near bar", Foo_tok = bar near
Note that I defined foo as "near bar" (with the quotes), but foo_tok got set to "bar near" (without the quotes). Is %deftok intended to return the tokens in reverse? Reading the documentation I expected %deftok would either only return the first token or a list of all the tokens, but in the order they appeared in my definition.

The NASM output is identical for these Win32 executables I had around (nasm -v):
Title: Re: %deftok bug or wrong expectation?
Post by: Rob Neff on September 06, 2010, 03:34:32 PM
That is not expected behavior and is not documented as such.
I've tested this on the latest release - Nasm v2.09
using the following and indeed get a reversed listing

nasm -f win32 toktest.asm

Code: [Select]
%define foo 'every rose has its thorn'
%deftok tok foo

%warning Foo = foo, Tok = tok


and get:

Code: [Select]
toktest.asm:4: warning: Foo = 'every rose has its thorn', Tok = thorn its has rose every


I would think a bug report is required.

Title: Re: %deftok bug or wrong expectation?
Post by: cm on September 06, 2010, 03:50:35 PM
Reported in bug tracker. Hope it still makes it into 2.09.01 :-)

Relevant link: https://sourceforge.net/tracker/?func=detail&aid=3060478&group_id=6208&atid=106208 (https://sourceforge.net/tracker/?func=detail&aid=3060478&group_id=6208&atid=106208)
Title: Re: %deftok bug or wrong expectation?
Post by: Cyrill Gorcunov on September 06, 2010, 08:28:31 PM
sorry for initial comment that I've fixed this bug, no i didn't yet, it was a wrong topic ;)
Title: Re: %deftok bug or wrong expectation?
Post by: Cyrill Gorcunov on September 07, 2010, 06:21:38 PM
this issue not yet fixed in 2.09.01, will be fixed in 2.09.02 I hope