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

[fix] Fix LocalPacker crashing when handling FieldRefs #549

Closed

Conversation

JRoper18
Copy link

The LocalPacker BodyInterceptor crashes with a NullPointerException when given any body with FieldRefs on the LHS of the assignment in it. This is mainly because it attempts to replace the FieldRef's local base value with BodyUtils.withNewUse(), which is not capable of doing usage replacements on the LHS of an assignment statement. This PR:

  1. Fixes the crash
  2. Adds a test that the issue is fixed
  3. Extends the local packer to work for these cases.

Closes #548

@JRoper18 JRoper18 marked this pull request as draft February 17, 2023 15:09
@swissiety
Copy link
Collaborator

swissiety commented Feb 17, 2023

Thx, for your contribution! The problem with the suggested solution is the LHS makes it the def and not the use so we need another approach to replace it in a higher layer replacing the def (as this is in the ReplaceUseSmtVisitor). in #465 is a implementation to replace Locals on both sides i.e. for def and use.

@JRoper18
Copy link
Author

But doesn't "GetUses" return values in the LHS as well? In "AbstractDefinitionStmt"

@JRoper18
Copy link
Author

Oh, I see -- the PR linked removes that.

@swissiety swissiety closed this May 24, 2023
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

Successfully merging this pull request may close these issues.

LocalPacker crashes with programs that contain FieldRefs
2 participants