https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70018

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Also one more point, in this example both inline functions have the same
definition.  Both answers are valid answers for this case.  That is doing the
division (causing the trap on x86_64) don't have to happen to get valid case.

Basically read up about ODR and the reason why both behaviors are valid.  If
always_false was returning two different values for the TU, then you would have
an ODR violation but since they return false in both TU removing or not
removing the divide is both valid answers as division by 0 is undefined
behavior at runtime.  That is both trap and not trapping is a valid behavior.


So in summary what you are seeing is two effects going into effect here:
undefined behavior of division by 0 and ODR.

Reply via email to