https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106687
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Andrew Macleod <amacl...@gcc.gnu.org>: https://gcc.gnu.org/g:de6d9e0b3d5c08896cbf047b299fc7f8d1e42be7 commit r13-2147-gde6d9e0b3d5c08896cbf047b299fc7f8d1e42be7 Author: Andrew MacLeod <amacl...@redhat.com> Date: Mon Aug 22 15:40:48 2022 -0400 Return the correct relation With an input condition of op1 > op2, and evaluating the unsigned expression: LHS = op1 - op2 range-ops was returning LHS < op1 , which is incorrect as op2 coould be zero. This patch adjusts it to return LHS <= op1. PR tree-optimization/106687 gcc/ * range-op.cc (operator_minus::lhs_op1_relation): Return VREL_LE for the VREL_GT case as well. gcc/testsuite/ * g++.dg/pr106687.C: New.