summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/pr47355.C
blob: 4fdbd9f5926226ba43a66d5820bf362172ed3bab (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
30
31
32
33
34
35
36
37
38
39
// PR tree-optimization/47355
// { dg-do compile }
// { dg-options "-O -fipa-cp -fipa-cp-clone" }

struct T
{
  T ();
  void *p;
  ~T ();
};

void foo (T *i);

T *bar ();
void baz (T *);

struct V
{
  long q;
  T *r;
  ~V ()
  {
    while (q)
      {
	foo (r);
	++r;
	--q;
      }
    baz (r);
  }
};

void
foo ()
{
  V v;
  T t;
  v.r = bar ();
}