c++ - Optimizing compiler removes bug -
so lot of people have posted on stack overflow how compiler optimizations introduce bugs program. however, i'm having opposite problem. i'm writing c++ program , have bug seems undefined behavior shows when set xcode's compiler off (none[-o0]). if set "fastest, aggressive optimizations [-ofast]", bug disappears.
so wondering if has experience optimization getting rid of bug (instead of more common case of optimization introducing bugs). common causes of this? i'm kind of @ loss of or check.
optimization can change evaluation order of expressions, if bug result, example, of specified evaluation order of foo() , bar() in:
some_function(foo(), bar()); then different optimization settings expose bug while other ones hide it.
there lots of other possibilities.
Comments
Post a Comment