https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84997
--- Comment #4 from joseph at codesourcery dot com <joseph at codesourcery dot com> --- On Wed, 21 Mar 2018, rguenth at gcc dot gnu.org wrote: > > That would need -fno-trapping-math, because if the addition results in a > > double value larger than INT_MAX, under Annex F the conversion back to int > > is defined to raise FE_INVALID along with producing an unspecified value. > > If it produces an unspecified value it doesn't raise undefined behavior, > right? In the presence of Annex F, it doesn't raise undefined behavior. In the absence of Annex F it does raise undefined behavior (but I don't think we want -fno-trapping-math to mean it's undefined, just that the FE_INVALID exception might be missing).