https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104356
--- Comment #14 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- > OK, so a division by zero is not invoking undefined behavior but is > well-defined and traps. And the idea is that -fnon-call-exceptions alone > carries this over to middle-end semantics? (I don't think it does that at > the moment, with or without the rev. in question) Why? It's exactly like any other trapping operation, see the numerous predicates in tree-eh.cc, most notably operation_could_trap_helper_p: switch (op) { case TRUNC_DIV_EXPR: case CEIL_DIV_EXPR: case FLOOR_DIV_EXPR: case ROUND_DIV_EXPR: case EXACT_DIV_EXPR: case CEIL_MOD_EXPR: case FLOOR_MOD_EXPR: case ROUND_MOD_EXPR: case TRUNC_MOD_EXPR: if (!TREE_CONSTANT (divisor) || integer_zerop (divisor)) return true;