summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/predcom-1.C
blob: 9e9a4b38cfa9fc4f2a4d56d0cff46fc8e5b2b6ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* Test for ICE in predictive commoning with empty loop header block
   on arm-none-linux-*.  */

struct Foo
{
  double *ptr;
  
  Foo (double *ptr_)
    : ptr (ptr_)
  {
  }
  
  Foo PostInc ()
  {
    return Foo (ptr++);
  }
};

bool Baz (Foo first, double *last)
{
  Foo prev (first.ptr);
  
  first.ptr++;

  while (first.ptr != last)
    if (*first.PostInc ().ptr < *prev.PostInc ().ptr)
      return false;
}