summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/predcom-1.C
blob: c668cac606dbfc9041288a39faf4db1f2bcdaa1e (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-gnueabi.  */

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;
}