https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30484
--- Comment #21 from Richard Biener <rguenth at gcc dot gnu.org> --- operation_could_trap_helper_p is also wrong in only checking for integer_zerop on the divisor though a literal x / -1 could be optimized to x * -1 and thus safely rewritten to unsigned arithmetic. Likewise RTLs may_trap_p_1 is wrong in the same way (that can also look at the first operand though). We might also want to have a SDIV_TRAPS_ON_OVERFLOW (mode) target hook which is half of the work to fix this very bug at RTL expansion time (not sure if we want to diverge earlier).