https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123864
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <[email protected]>: https://gcc.gnu.org/g:238d2fc116cdef31c3d643e71ade0875b5cba110 commit r16-7183-g238d2fc116cdef31c3d643e71ade0875b5cba110 Author: Jakub Jelinek <[email protected]> Date: Fri Jan 30 11:42:41 2026 +0100 match.pd: Fix up __imag__ .MUL_OVERFLOW simplification [PR123864] The integer_minus_onep case is really meant for multiplication by -1, not by (unsigned char)0xff or (unsigned short)0xffff or 0xffffffffU etc. We've already tested that the first operand is signed (otherwise the earlier case is used) and also that int_fits_type_p (@1, TREE_TYPE (@0)), but if @0 is signed and @1 is unsigned all ones with smaller precision than that, it fits into @0's type, integer_minus_onep will be true and it still should be handled through the ranges, not as @0 == min. 2026-01-30 Jakub Jelinek <[email protected]> PR tree-optimization/123864 * match.pd (__builtin_mul_overflow_p (x, cst, (stype) 0) -> x > stype_max / cst || x < stype_min / cst): Only check integer_minus_onep for signed types. * gcc.c-torture/execute/pr123864.c: New test. * gcc.dg/torture/pr123864.c: New test.
