Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

I get strange debugger behaviour when using GCC with optimization. Why?

0
Posted

I get strange debugger behaviour when using GCC with optimization. Why?

0

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…

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123