summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/pr105276.C
blob: ad0e9dd7e09752203fa8f544e7c79c7eee8d7a64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */

bool
foo(unsigned i)
{
  bool result = true;
  while (i)
    {
      i = i % 3;
      i = i - (i == 2 ? 2 : i ? 1 : 0);
      result = !result;
    }
  return result;
}

/* We should be able to eliminate the i - operation.  */
/* { dg-final { scan-tree-dump-not "i_.* - " "optimized" } } */