Re: Pure/const function not getting executed as the first operand to logical OR ( || ) (C++)

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

 



On Sun, 23 Jan 2022, Vishal Subramanyam via Gcc-help wrote:

is there a specific name for the type of optimization where the compiler simply decides to drop the return value.

Gcc handles this as part of dead code elimination (among others). A simpler example would be

int main(){ 1/0; }

which does not crash either.

If you want to make your function func opaque to the optimizers, you may be interested in __attribute__((noipa)). Using volatile would also avoid some optimizations.

--
Marc Glisse



[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