flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > [fasmg] segfault (iteration too high + no enough memory) |
Author |
|
Tomasz Grysztar 11 Nov 2019, 15:07
Thank you for the report! I found a pointer corruption bug in IRPV handler. I minimized your sample to expose it:
Code: repeat $DEED x =: '1' end repeat irpv it, x db it end irpv |
|||
11 Nov 2019, 15:07 |
|
Tomasz Grysztar 11 Nov 2019, 15:17
Back to your original snippet - such linear search is definitely a sub-optimal method of looking for an existing definition.
A trick I could recommend is to convert the string that contains section name into something that can be used as a label name in fasmg, and then you can make fasmg look up whether such name has been declared already. For example, you can simply convert any string to a decimal number and then use this number as a label name: Code: _sections? := $00 namespace _sections? end namespace macro section? name?* local present present = $00 repeat 1, d:name if definite _sections.d present = $01 else _sections.d := name end if end repeat end macro repeat $DEED, i:$00 section (`i) end repeat |
|||
11 Nov 2019, 15:17 |
|
MaoKo 11 Nov 2019, 19:51
You're welcome. I like the idea of contributing to fasmg . Thx for the tips too. In fact my whole code with 100+ sections was very slow (0.5 sec).
The problem is that, I record not only the section name but also the origin, alignement,... So for retreive the original value in a postpone block I do an irpv break for each field. But I guess now, I can speed up the whole things . |
|||
11 Nov 2019, 19:51 |
|
MaoKo 14 Nov 2019, 16:21
Hi! After some experiment, I think that I found another bug (segfault/abort) on Linux/Unix. This concern the use of "?" in front of an identifier in an irpv and an namespace block.
Code: Magic? := $00 namespace Magic? ?$CAFE? := "JAVA" end namespace irpv item, Magic?.?$CAFE? display (`item), $0A ; segfault here end irpv Hope this might help . Last edited by MaoKo on 15 Nov 2019, 02:13; edited 1 time in total |
|||
14 Nov 2019, 16:21 |
|
Tomasz Grysztar 14 Nov 2019, 16:51
The "?" in front of an identifier is a modifier of an entire identifier, it cannot be used in a middle of identifier like you did. The symbol that you defined has a case-insensitive name "$CAFE" and this is how you should access it:
Code: irpv item, Magic?.$CAFE? You can either display the value directly, assuming it is a string: Code: Magic? := $00 namespace Magic? ?$CAFE? := "JAVA" end namespace irpv item, Magic?.$CAFE? display item, $0A end irpv Code: Magic? := $00 namespace Magic? ?$CAFE? equ "JAVA" end namespace irpv item, Magic?.$CAFE? display `item, $0A end irpv |
|||
14 Nov 2019, 16:51 |
|
MaoKo 14 Nov 2019, 17:29
Thx Tomasz. I fact I knew for the "?", this was originally a typo that I made when writing some code.
However I thought that the proxy name "." only apply to negative value. But the whole code is just a proof of concept for the crash. Not in use in production obviously |
|||
14 Nov 2019, 17:29 |
|
MaoKo 23 Nov 2019, 20:39
Tomasz? What going on with this segfault?
|
|||
23 Nov 2019, 20:39 |
|
Tomasz Grysztar 23 Nov 2019, 21:27
Oh, I'm sorry, I completely forgot about it. Please try the "iqyjc" release.
|
|||
23 Nov 2019, 21:27 |
|
MaoKo 23 Nov 2019, 21:54
Yes thx. Your are fast x).
|
|||
23 Nov 2019, 21:54 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.