Re: Avoid removing an if (false) statement and its corresponding branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/23/23 14:45, Julian Waters via Gcc-help wrote:
Hi all,

Is there a way to stop gcc from nuking an if (false) statement and the
corresponding branch from the compiled code for debugging purposes?
Even turning off all optimizations doesn't achieve this

best regards,
Julian

IMO the simplest way would be to define something like `static const volatile bool unoptimizable_false = false;` somewhere and use it in place of `false`, when you want to avoid the if statement being optimized out.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux