Hi,
I have a problem that causes a register to get corrupted and eventually a wrong result.
Description
The routine that delivers wrong results goes like:
someRoutine()
{
for loop
{
aRoutineThatUsesNeon(someArguments);
// some computations
float a = 3 * b - c / 2;
// other computations
// dummyRoutine();
}
}
Diving into the assembly reveals that 3 * b is miscomputed, since the constant 3 is set to register s22 before the loop, but the invocation of aRoutineThatUsesNeon changed this value so the overall result is wrong.
Apparently the compiler assumes that s22 will not be changed during the loop.
Curiously, if the call to dummyRoutine is uncommented, the problem goes away (this is my current workaround).
More Info
The problem happens in release mode only.
The NDK version is r9d, running on Windows 8, 64 bit.
aRoutineThatUsesNeon uses the NE10 library.
Questions
Is it a problem with the compiler - too aggressive optimization, or with the called routine - messing up with s22 register, or some other reason?
How to solve the problem other than calling dummyRoutine?
Thanks.