Debian Codegraph @

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

raw
1 // PR tree-optimization/104334
2 // { dg-do run { target c++11 } }
3 // { dg-options "-O2 --param logical-op-non-short-circuit=0" }
4
5 enum class A { A0, A1, A2, A3 };
6 int x;
7
8 __attribute__((noipa)) void
9 baz ()
10 {
11 x = 1;
12 }
13
14 struct B {
15 unsigned b : 2;
16
17 A
18 foo () const
19 {
20 return static_cast<A> (b);
21 }
22
23 __attribute__((noinline)) void
24 bar ()
25 {
26 if (foo () == A::A2 || foo () == A::A3)
27 baz ();
28 }
29 };
30
31 int
32 main ()
33 {
34 B c;
35 c.b = 2;
36 c.bar ();
37 if (x != 1)
38 __builtin_abort ();
39 return 0;
40 }