summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ipa/pr63574.C
blob: 59b82d53ba8b4cf6b9e4895077e56cda4335b528 (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
40
41
42
43
44
45
46
47
/* { dg-do compile } */
/* { dg-options "-O3" } */

class test
{
public:
  test (int val, int *p)
  {
    int_val = *p;
    bool_val = (val != int_val);
  }

  ~test ()
  {
    if (!bool_val)
      return;
  }

  int get_int_val () const
  {
    return int_val;
  }

private:
  bool bool_val;
  int int_val;
};

static int __attribute__ ((noinline))
f1 (int i, int *p)
{
  test obj (i, p);
  return obj.get_int_val ();
}

static int __attribute__ ((noinline))
f2 (int i, int *p)
{
  test obj (i, p);
  return obj.get_int_val ();
}

int
f (int i, int *p)
{
  return f1 (i, p) + f2 (i, p);
}