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, 2022-01-23 at 09:56 +0000, Vishal Subramanyam wrote:
> This still doesn't explain why an O1 level optimization can violate
> the standard by not evaluating the first operand.

It's not violating the standard.  The standard says division-by-zero is
an undefined behavior, so the compiler can do anything.

> What optimization is my code triggering with -fno-inline? My function
> clearly has a return value, so how did the compiler
> decide that the return value doesn't matter?

-- 
Xi Ruoyao <xry111@xxxxxxxxxxxxxxxx>
School of Aerospace Science and Technology, Xidian University



[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