https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70992
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- I think the issue is that the associate case treats (0 % 0 + 1) * 2 as constant but that gets further "simplified" when combined with the rest. In the end our refusal to simplify 0 % 0 to 0 causes things to go downhill (we _do_ simplify 0 % a to 0!) (for mod (ceil_mod floor_mod round_mod trunc_mod) /* 0 % X is always zero. */ (simplify (mod integer_zerop@0 @1) /* But not for 0 % 0 so that we can get the proper warnings and errors. */ (if (!integer_zerop (@1)) @0))