https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109344
Bug ID: 109344 Summary: feraiseexcept produces incorrect code when optimizations are enabled Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: albin at yahoo dot com Target Milestone: --- At -O1, calls to feraiseexcept are inlined. But the inlined code produces incorrect results. See here, only the first function behaves as expected: https://godbolt.org/z/ncc3cjoKh The behavior persists across many versions. (A side note, I don't understand how the first function works, in order to produce a divbyzero exception it appears to divide 0 / 1, not 1 / 0, am I reading the assembly wrong?)