]> git.ipfire.org Git - people/ms/gcc.git/commit
Return the correct relation
authorAndrew MacLeod <amacleod@redhat.com>
Mon, 22 Aug 2022 19:40:48 +0000 (15:40 -0400)
committerAndrew MacLeod <amacleod@redhat.com>
Tue, 23 Aug 2022 01:04:44 +0000 (21:04 -0400)
commitde6d9e0b3d5c08896cbf047b299fc7f8d1e42be7
tree00da3a5299ca384e2b3a810868cc26c009ffece8
parent3b2e3fa39dd2b606566f47006d015f9c447dcc7d
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.
gcc/range-op.cc
gcc/testsuite/g++.dg/pr106687.C [new file with mode: 0644]