This is NOT NEW but it still worths being emphasized again…
In my current render engine I have a bool variable that needs to be evaluated like this:
while(bIsRunning);
this piece of code controls the termination of one thread. In debug mode it works fine, but it never ends in release mode – compiler did some harmful optimization that bIsRunning was not evaluated iteratively as code indicates.
Fixing is quite simple:
volatile bool bIsRunning;
Actually this is a common issue in hardware driver development..