CFR incorrectly places the auto increment statement of the outer loop in the nested loop
AIRTEspresso opened this issue · comments
CFR version
CFR version: 0.152
Compiler
Java openJDK, version: 11.0.13
Description
Here is one more case that the code generated by CFR gave different execution results compared with the source code. CFR may incorrectly place the auto increment statement of the outer loop in the nested loop: for the '++i8' increment of the outer loop, CFR placed the the equivalent increment 'n++' in the nested do-while-loop.
The total case is available at error example and I hope it can be helpful.
Example
The source code:
void mainTest(){
int i8 , i10 , iArr1[]= new int[N];
for(i8 = 6; i8 < 128; ++ i8){
i10 = 1;
do iArr1[i8]*= fFld;
while(++ i10 < 13);
}
System.out.println("i8=" + i8);
}
The code decompiled by CFR:
void mainTest() {
int[] nArray = new int[this.N];
int n = 6;
while (n < 128) {
int n2 = 1;
do {
int n3 = n++;
nArray[n3] = (int)((float)nArray[n3] * this.fFld);
} while (++n2 < 13);
}
System.out.println("i8=" + n);
}