Debian Codegraph @

gcc/testsuite/g++.dg/opt/pr50682.C

raw
1 // PR tree-optimization/50682
2 // { dg-do compile }
3 // { dg-options "-O2 -fnon-call-exceptions -ftracer -fno-tree-ccp -fno-tree-copy-prop -fno-tree-dce" }
4
5 void foo () __attribute__ ((__noreturn__));
6 int baz ();
7
8 const int &
9 bar (const int &x, const int &y)
10 {
11 if (x >= y)
12 return y;
13 return x;
14 }
15
16 int a, b;
17
18 struct S
19 {
20 ~S ();
21 bool m ()
22 {
23 int l = bar (a, b);
24 int r = baz ();
25 if (r)
26 r = l;
27 return r;
28 }
29 };
30
31 void
32 test ()
33 {
34 S s;
35 if (!s.m ())
36 foo ();
37 if (!s.m ())
38 foo ();
39 }