-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lcc: compiler crash #73
Comments
Crash happens in emitasm, before returning:
In
(Note: rulenum == 26) Jumping to:
Was introduced with 5916cb2 p->kids[0]->syms[0]->x.regnode is a null pointer. (Note: p->kids[0]->syms[RX].x.regnode is a null pointer as well) dumptree(p) after entering inst_strunc() gives:
|
Simplification of test program that crashes LCC:
|
Interestingly, this was commented out in e58bf0c Utils/lcc/src/gen.c:
If we re-enable, the compilation completes without crashing LCC itself. Resulting output:
This looks correct to me and gttest passes. However......... Libs/Example.c doesn't work anymore. There are many changes in the emitted code (mostly ANDI $ff instructions are now gone) and, for example, __lookup/LUP is broken:
Close, but no cigar. |
This would be a good point to ask @pgavlin for some insights :-) |
This is the point at which I wish that I had gone back and commented things up a bit more. I disabled the conversion of CVI/CVU/CVP to LOAD because it was breaking the backend's assumption that all LOADs are from vAC to a virtual register or vice-versa. We could probably tweak things such that the conversion works, but I'm not 100% certain what those tweaks would be offhand. It's a bit strange that the register allocator appears not to be allocating those nodes... I'll try running |
I can work-around it in my C library and made a note in my updated Libs/stdio/fputc.c that found the issue. |
Fyi, I spent the best part of the last few days on the other issue:
#76 <#76>
Basically: nested multiplicative expressions such as "a * (b / c)" don’t compile.
LCC gets in an infinite loop of spilling and reloading vAC but I’m stuck at understanding it.
It spills vAC at some point, which is fine and understandable.
Later it reloads, but at that point vAC is allocated, so it wants to spill it again. etc
(The message “inserting load from vAC to vAC” looks like a red herring.)
… On 13 May 2019, at 22:24, Pat Gavlin ***@***.***> wrote:
This is the point at which I wish that I had gone back and commented things up a bit more.
I disabled the conversion of CVI/CVU/CVP to LOAD because it was breaking the backend's assumption that all LOADs are from vAC to a virtual register or vice-versa. We could probably tweak things such that the conversion works, but I'm not 100% certain what those tweaks would be offhand.
It's a bit strange that the register allocator appears not to be allocating those nodes... I'll try running cpp and rcc manually (rather than via the driver) to get debug output.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#73?email_source=notifications&email_token=AC5ZS3RQX5PESYR3DRMWR7DPVHFBDA5CNFSM4HMH77S2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVJOQVI#issuecomment-491972693>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AC5ZS3TAAZL7C6DWWHYZEUDPVHFBDANCNFSM4HMH77SQ>.
|
This issue should be closed since glcc fixes it. |
Edit: see simplification below
The text was updated successfully, but these errors were encountered: