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
Reference counting issue with GetElementPtr #756
Comments
The cleanest way to fix might be to somehow keep track of the fact that
Now the lifetime of We'll also need to consider any pointer derived from Another option would be to merge |
Oh, this is nasty. If it's a release blocker, probably revert if it isn't too disruptive? One quick-and-dirty approach would be to add a no-op keep-alive op, and generate it after the load_mem to "pin" So we'd generate
|
If we can't get fix out today, I'm probably going to create a branch form an earlier commit and cherry pick some of the following commits, as there aren't many of them.
That's a clever idea! It feels a bit hacky, so I'm still trying to update liveness analysis to somehow do the right thing here, but this seems better than merging the ops. |
Here's my current idea about how to fix liveness analysis:
|
My latest idea is to use a variant of the unpin approach, for simplicity. Since this only affects |
Add optional reference to the object from which we are reading from to `LoadMem` so that the object won't be freed before we read memory. Fixes mypyc/mypyc#756.
Add optional reference to the object from which we are reading from to `LoadMem` so that the object won't be freed before we read memory. Fixes mypyc/mypyc#756.
Consider this code:
It gets compiled into this (incorrect) code:
This results in segfaults in some cases, but simple examples may work correctly most of the time.
The text was updated successfully, but these errors were encountered: