https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64295
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- Ok, so we're folding g / 3 -> g * (1 / 3) and then applyign the same transform to 1 / 3 (because that's not constant folded with -frounding-math). I believe the option combination is a red herring, but ... The original fold-const.c code only transformed this if 1 / 3 constant folded but I used fold_binary in the pattern (because const_binop wasn't available at the point of writing it). Testing a patch.