https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92297
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Luca Rocca from comment #2) > Division by 0 is always undefined, regardless of the numerator. > So, 0 / X should not be simplified if we cannot exclude that X = 0. No. You don't need to exclude X=0 because if X=0 the behaviour is undefined and so any result is valid (including the result of simplifying it). > Then if X = 0 we should expect an exception triggered at runtime, > as we have for example for 1 / 0. No, that's not what undefined behaviour means. You are wrong to expect a runtime error, that would be *defined* behaviour.