https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121711

            Bug ID: 121711
           Summary: `a - b == 16` should imply that `a == b + 16`
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
            Blocks: 85316, 116651
  Target Milestone: ---

testcase:
```
void link_error();
void f0(int a, int b, int c)
{
  int t = b - a;
  if (t == 1)
  {
    if (a + 1 != b)
      link_error();
  }
}
void fp(int *a, int *b, int *c)
{
  auto t = b - a;
  if (t == 1)
  {
    if (a + 1 == b)
    {
      link_error();
    }
  }
}
void fp1(int *a, int *b, int *c)
{
  if (b == a+1)
  {
    auto t = b - a;
    if (t == 1)
    {
      link_error();
    }
  }
}
```

these all should be empty.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85316
[Bug 85316] [meta-bug] VRP range propagation missed cases
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116651
[Bug 116651] vector::operator== on a newly created single element vector is not
that good

Reply via email to