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

do/while loop includes an instruction before the loop #25

Open
AdamMil opened this Issue Feb 3, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@AdamMil
Copy link

AdamMil commented Feb 3, 2019

Compile this code:

i = 1
do j = 0 while (j)

Then decompile it with NutCracker. The result is:

do
{
        this.i = 1;
        this.j = 0;
}
while (this.j);

In general, one operation before a do/while loop is included in the loop. I believe the reason is that the beginning of the loop is calculated incorrectly. In PreprocessDoWhileInfo there's this line:

int beginPos = endPos + curInst.arg1;

I think it should be replaced with:

int beginPos = endPos + 1 + curInst.arg1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment