I get strange debugger behaviour when using GCC with optimization. Why?
In recent versions of GCC, which are provided with Ride7, when optimization is activated, a line of C code is often split in two (or more) parts. The first part is for initialization and the second part for execution. For a block of C code, the initialization of all lines of C code in the block is done first, followed by all the executions. This allows factorization of the initialization parts between several lines of C code or other really efficient optimizations. The drawback is that debugging is much less convenient. This also often makes people think that there is a bug in the compiler or debugger when in fact it’s just optimization. For example…