flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Unhandled exception at 0x004028CB in fasmg.exe: 0xC0000005

Author
Thread Post new topic Reply to topic
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 11 Feb 2017, 01:03
The below code causes Unhandled exception at 0x004028CB in fasmg.exe: 0xC0000005: Access violation reading location 0x002DA7FD.

The problem is in calling store from store
Code:
true  := 1
false := 0

struct MY
  a rw 1
end struct

_my MY a: 'a'

macro struct? name

  struc rb? n
    label .
    rb n
    .__length = $ - .
    .__size = 1
  end struc

  struc rw? n
    label .
    rw n
    .__length = $ - .
    .__size = 2
  end struc

  macro store name, value, i
    virtual at 0
      dbx .name.__length: value
      len = $ - i * .name.__size
    end virtual
    store value:len at .name + i * .name.__size
  end macro

  macro end?.struct?!
      end namespace
      irp def, args
        local param, value, i, len, is_seq
        value equ
        i = 0
        len = 0
        is_seq = false
        match name:value, def
          store name, value, i
        end match
      end irp
    end struc
    virtual at 0
      name name
      sizeof.name = $
    end virtual
    purge end?.struct?
  end macro

    struc name args&
      label .:sizeof.name
      namespace .
end macro
    
Post 11 Feb 2017, 01:03
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8349
Location: Kraków, Poland
Tomasz Grysztar 11 Feb 2017, 12:52
Thank you for the report, it is fixed now.

You have an infinite recursion there and it helped uncover a rarely occurring bug. To avoid the recursion you should either define the STORE macro as case-insensitive symbol ("macro store?") or call the original store macro with "store?" identifier to choose the original case-insensitive over the case-sensitive one.
Post 11 Feb 2017, 12:52
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.