aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/opt/pr50682.C
blob: b7e91f45d73dff5edfffad6bdde44370b44c01c0 (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/50682
// { dg-do compile }
// { dg-options "-O2 -fnon-call-exceptions -ftracer -fno-tree-ccp -fno-tree-copy-prop -fno-tree-dce" }

void foo () __attribute__ ((__noreturn__));
int baz ();

const int &
bar (const int &x, const int &y)
{
  if (x >= y)
    return y;
  return x;
}

int a, b;

struct S
{
  ~S ();
  bool m ()
  {
    int l = bar (a, b);
    int r = baz ();
    if (r)
        r = l;
      return r;
  }
};

void
test ()
{
  S s;
  if (!s.m ())
    foo ();
  if (!s.m ())
    foo ();
}