1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-dse2-details" } */
3 /* { dg-final { scan-tree-dump-not "Deleted dead store" "dse2" } } */
4
5 struct foo { unsigned long bar; };
6
7 unsigned y;
8
9 static int __attribute__ ((__noinline__, __noclone__))
10 wrapped (struct foo *p, int i);
11
12 static int wrapper (struct foo *p);
13
14 static int __attribute__ ((__noclone__))
15 wrapper (struct foo *p) {
16 return wrapped (p, 1);
17 }
18
19 static int __attribute__ ((__noinline__, __noclone__))
20 dind (struct foo **pp);
21
22 int __attribute__ ((__noclone__, __no_reorder__))
23 xfn () {
24 struct foo x = { 0xBADC0FFE };
25 struct foo *p = &x;
26 return dind (&p);
27 }
28
29 static int __attribute__ ((__noinline__, __no_reorder__))
30 wrapped (struct foo *p, int i) {
31 return p->bar + i == y++;
32 }
33
34 static int __attribute__ ((__noinline__, __noclone__, __no_reorder__))
35 dind (struct foo **pp) {
36 wrapper (*pp);
37 return 0;
38 }