There is a structure with size of 16-Bytes, and an array of it is defined. The disassembly code for navigation through the array is:
MOV i, i,LSL#4
LDR R4, =arr_of_struct
ADD i, i, R4
LDR var, [i]
But the decompiled code is:
var = arr_of_struct[4 * i];
Which is wrong and should be:
var = arr_of_struct[4 * i].field_0;
I think the problem is in first line of disassembly MOV i, i,LSL#4
. Obviously it is multiplying the array index by 16 which is the size of my struct. But IDA translated this line to [4 * i]
!!!
So the first question is what's the reason of this behavior in IDA? And the second is how can I fix this?
EDIT: More information: