Author Topic: %deftok bug or wrong expectation?  (Read 14563 times)

Offline cm

  • Jr. Member
  • *
  • Posts: 65
%deftok bug or wrong expectation?
« 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):
  • NASM version 2.09rc7-20100820 compiled on Aug 20 2010
  • NASM version 2.09 compiled on Aug 27 2010
  • NASM version 2.09-20100825 compiled on Aug 25 2010
  • NASM version 2.10rc1 compiled on Aug  9 2010
C. Masloch

Offline Rob Neff

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 429
  • Country: us
Re: %deftok bug or wrong expectation?
« Reply #1 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.


Offline cm

  • Jr. Member
  • *
  • Posts: 65
Re: %deftok bug or wrong expectation?
« Reply #2 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
C. Masloch

Offline Cyrill Gorcunov

  • NASM Developer
  • Full Member
  • *****
  • Posts: 179
  • Country: 00
Re: %deftok bug or wrong expectation?
« Reply #3 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 ;)

Offline Cyrill Gorcunov

  • NASM Developer
  • Full Member
  • *****
  • Posts: 179
  • Country: 00
Re: %deftok bug or wrong expectation?
« Reply #4 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