https://gcc.gnu.org/g:465f1d987bf0c8c099cb01e68ba167f3929081d6
commit r17-1731-g465f1d987bf0c8c099cb01e68ba167f3929081d6 Author: Pan Li <[email protected]> Date: Wed Jun 17 21:48:35 2026 +0800 Match: Ensure call to tree_to_uhwi is checked in SAT_* pattern(s) Per-suggestion from Pinski, add the tree_fits_uhwi_p before the call to tree_to_uhwi. For making sure the precondition of the tree_to_uhwi is met. gcc/ChangeLog: * match-sat-alu.pd: Add fits check before call to tree_to_uhwi. Signed-off-by: Pan Li <[email protected]> Diff: --- gcc/match-sat-alu.pd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/match-sat-alu.pd b/gcc/match-sat-alu.pd index c47d73f958d6..6e6fd2afda76 100644 --- a/gcc/match-sat-alu.pd +++ b/gcc/match-sat-alu.pd @@ -512,7 +512,7 @@ along with GCC; see the file COPYING3. If not see INTEGER_CST@2) integer_zerop) @3 INTEGER_CST@4)) - (if (types_match (type, @0, @1)) + (if (types_match (type, @0, @1) && tree_fits_uhwi_p (@2)) (with { unsigned prec = TYPE_PRECISION (type); @@ -562,7 +562,7 @@ along with GCC; see the file COPYING3. If not see (negate (convert (ne (convert2? (rshift @3 INTEGER_CST@2)) integer_zerop)))) (convert (usmul_widen_mult@3 @0 @1))) - (if (types_match (type, @0, @1)) + (if (types_match (type, @0, @1) && tree_fits_uhwi_p (@2)) (with { unsigned prec = TYPE_PRECISION (type);
