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

Fixing removeUnreachable not searching in all blocks #2082

Merged
merged 1 commit into from
Jan 14, 2024

Conversation

Away-pp
Copy link
Contributor

@Away-pp Away-pp commented Jan 14, 2024

The method removeUnreachableBlocks was iterating through all the methods basic blocks but only keeping the last result found (in toRemove).

This will create an error later when the method checkForUnreachableBlocks is called.

Therefore, the fix is to use only one instance of the object toRemove and keep all the information there.

@skylot
Copy link
Owner

skylot commented Jan 14, 2024

@Away-pp thanks! It is a very stupid mistake 😭
Although, removing unreachable blocks is a bad idea in most cases because it is just hiding blocks processing issues.
I will try to review such approach and remove only real dead code on a very early stages before jadx do any changes to blocks tree.

@skylot skylot merged commit 2805770 into skylot:master Jan 14, 2024
5 checks passed
@Away-pp
Copy link
Contributor Author

Away-pp commented Jan 14, 2024

I understand that there are other issues with unreachable blocks, but I think that maintaining this function is ok, not a big issue.
This commit was the first part to fix a specific decompilation problem (will make the pull request later).

By the way, I don`t think it was a stupid mistake. It just happens.

Thank you for the quick review.

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.

2 participants