Skip to content
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

Symbolization bug in the pattern lowering #776

Open
larshum opened this issue Aug 15, 2023 · 0 comments
Open

Symbolization bug in the pattern lowering #776

larshum opened this issue Aug 15, 2023 · 0 comments

Comments

@larshum
Copy link
Contributor

larshum commented Aug 15, 2023

@asta12 discovered a bug where the AST ends up with multiple instances of the same symbol. This leads to problems in the lambda lifting because it assumes all bindings have unique identifiers. My hypothesis is that we have not discovered this earlier because passes in the main compiler do not require identifiers to be unique. The reason is that the pattern lowering duplicates code without resymbolizing it.

I have not found a smaller example than stdlib/json.mc. When compiled as mi compile --debug-shallow --test --exit-before stdlib/json.mc, the output (it's a lot, I typically redirect it to a file) contains multiple bindings of identifier matchBody105 with identical bodies (i.e., because they use the same symbols). If the output is printed earlier (e.g., by inserting a print just before the pattern lowering in the compiler), the output does not contain bindings with identical symbols.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant