https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126458
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrea Pinski <[email protected]>: https://gcc.gnu.org/g:667c1b70ac3955c9ac7ccab60cc10b32d4bed5ff commit r17-2854-g667c1b70ac3955c9ac7ccab60cc10b32d4bed5ff Author: Andrea Pinski <[email protected]> Date: Thu Jul 30 21:06:31 2026 -0700 match: Fix min/max patterns for `((signed)a) < 0` [PR126458] In r16-4585-ga4e033fb51d566, I accidently used the wrong type to form SIGNED_TYPE_MIN. This was ok most of the time except if the two types differ only by one precision. When they diff by one precision, we would incorrectly detect the wrong thing and think it should be a min/max. This fixes the problem by using the precision of the constant (0) rather then the final type. Pushed as obvious after a bootstrap/test on x86_64-linux-gnu. PR tree-optimization/126458 gcc/ChangeLog: * match.pd (min/max detection): Fix precision of the signed type min. gcc/testsuite/ChangeLog: * gcc.dg/torture/pr126458-1.c: New test. Signed-off-by: Andrea Pinski <[email protected]>
