flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > [fasmg] Error: could not generate code...

Author
Thread Post new topic Reply to topic
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 22 Jan 2017, 17:08
Error: could not generate code within the allowed number of passes.

Well, it took me some time to find what had been causing this error, as no additional information was displayed.

It appeared, that I have a struct definition:

Code:
struct EFI_GRAPHICS_OUTPUT_MODE_INFORMATION
  Version               rd 1
  HorizontalResolution  rd 1
  VerticalResolution    rd 1
  PixelFormat           rd 1
  PixelInformation      EFI_PIXEL_BITMASK
  PixelsPerScanLine     rd 1
ends
    


and I also have a macro

Code:
struct VERSION_INFO
  Major     rd 1
  Minor     rd 1
  Patch     rd 1
  Build     rd 1
ends

macro Version name, ver
  match maj.min.p, ver
    name VERSION_INFO Major:0x#maj, Minor:0x#min, Patch:0x#p, Build:%t
  else
    err 'Valid version in x.y.z format is expected'
  end match
end macro
    


Not sure if this is as designed, but if it is, then extreme care should be taken when giving names to macros and structures entries
Post 22 Jan 2017, 17:08
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 22 Jan 2017, 19:47
Yes, this is an old problem that when you can redefine everything, it is easy to shoot yourself in the foot.

On the other hand, unlike fasm 1, fasmg has some facilities that allow to prevent this specific problem that you encountered. An implementation of "struct" could use "macro ?" or even "macro ?!" to intercept and parse all lines of its block. In fact I plan to prepare such macro myself, because my planned macro which would be compatible with fasm 1 "struct" would need to work exactly like that.
Post 22 Jan 2017, 19:47
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.