https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113189
--- Comment #2 from Joseph S. Myers <jsm28 at gcc dot gnu.org> --- If Y is INT_MIN and X is -1, removing the negations introduces undefined behavior in the first example (-(-1) * INT_MIN * -(-1) is valid, -1 * INT_MIN * -1 has undefined behavior). For floating types, removing the negations isn't valid if flag_rounding_math.