Debian Codegraph @

gcc/testsuite/g++.dg/torture/pr96881-2.C

raw
1 /* { dg-do run } */
2
3 struct S { int s; ~S () {} } s;
4
5 void __attribute__((noipa))
6 foo (int flag)
7 {
8 s.s = 1;
9 // We have to makes sure to not make the inlined CLOBBER
10 // unconditional but we have to remove it to be able
11 // to elide the branch
12 if (!flag)
13 return;
14 s.~S();
15 }
16
17 void __attribute__((noipa))
18 bar (int flag)
19 {
20 s.s = 1;
21 // CD-DCE chooses an arbitrary path, try to present it
22 // with all variants
23 if (flag)
24 s.~S();
25 }
26
27 int
28 main ()
29 {
30 foo (0);
31 if (s.s != 1)
32 __builtin_abort ();
33 bar (0);
34 if (s.s != 1)
35 __builtin_abort ();
36 return 0;
37 }