I've seen this in the past due to uninitialised variables. With optimisation, the compiler gets more aggressive about register re-use, so a bug can manifest under optimisation when the uninitialised variable ends up in a register that had a previous value in it. (In debug mode, the variable often picks up a zero value instead.)
Not sure if there is an easy way to track down whether this is the case or if this is a genuine code generation problem.
Good catch!
I've seen this in the past due to uninitialised variables. With optimisation, the compiler gets more aggressive about register re-use, so a bug can manifest under optimisation when the uninitialised variable ends up in a register that had a previous value in it. (In debug mode, the variable often picks up a zero value instead.)
Not sure if there is an easy way to track down whether this is the case or if this is a genuine code generation problem.