NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: c051n3 on July 22, 2010, 12:50:35 AM

Title: [false alarm] nasm v2.09rc4 bug when accessing parent context stack var
Post by: c051n3 on July 22, 2010, 12:50:35 AM
I think there is a bug with context stacks and context local vars.
I am using nasm v2.09rc4 built from source with VS2005 64bit.
I developed the following macro to automate testing of the context stack and context local variables.
Yes I realize it's only cursory tests however it encounters an error when trying to access context local
variables above the currently defined context.

Code: [Select]
; check for regression errors
%macro ctx_stack_check 0
  ; define some macro local vars
  %define %%ctx1name _TESTCTX1
  %define %%ctx2name _TESTCTX2

  ; create a context
  %push %%ctx1name

  ; define a context local var
  %define %$_ctxvar ctxdata_1

  ; create a new context stack top
  %push %%ctx2name

  ; test current context stack name
  %ifnctx %%ctx2name
    %fatal  inconsistant context stack name
  %endif

  ; define a context local var reusing
  ; the same name
  %define %$_ctxvar ctxdata_2

  ; test current context stack local var
  %ifnidn %$_ctxvar, ctxdata_2
    %fatal  inconsistant context stack local var
  %endmacro

  ;=========================================================
  ; ERRORS OUT IN THE FOLLOWING TEST
  ;=========================================================
  ; test parent context stack local var
  %ifnidn %$$_ctxvar, ctxdata_1
    %fatal  inconsistant parent context stack local var
  %endmacro

  ; pop off top of context stack
  %pop

  ; verify parent is now top of stack
  %ifnctx %%ctx1name
    %fatal unknown context stack name
  %endif

  ; verify context local var is valid
  %ifnidn %$_ctxvar, ctxdata_1
    %fatal context local var is valid
  %endmacro

  ; %fatal context stack check successful

%endmacro

; now call the macro
ctx_stack_check

Can someone look at this and determine if I am doing this in error or if nasm is bugging out.
Title: Re: nasm v2.09rc4 bug when accessing parent context stack var
Post by: c051n3 on July 22, 2010, 02:20:22 AM
In my zeal to create a quick test I realized I have misplaced endifs with endmacros...

Please ignore this post and my dumb mistakes  ::)