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

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -