[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / gcc.dg / pr82916.c
blob50e467f32447f1b71b07d7eff9d62f42dd40a50b
1 /* PR bootstrap/82916 */
2 /* { dg-do run } */
3 /* { dg-options "-O2 -fno-tree-dse" } */
5 struct A { struct A *next; };
6 struct C
8 int *of;
9 struct C *parent, *prev, *next;
10 int depth;
11 int min;
12 struct C *min_occ;
15 __attribute__((noipa)) struct C *
16 foo (int *node)
18 struct A *p = __builtin_malloc (sizeof (struct C));
19 if (!p)
20 return 0;
21 p->next = 0;
22 /* Originally placement new. */
23 struct C *nw = (struct C *)(void *)p;
24 nw->of = node;
25 nw->parent = 0;
26 nw->prev = 0;
27 nw->next = 0;
28 nw->depth = 0;
29 nw->min_occ = nw;
30 nw->min = 0;
31 return nw;
34 int
35 main ()
37 int o;
38 struct C *p = foo (&o);
39 if (p)
41 if (p->of != &o || p->parent || p->prev || p->next || p->depth
42 || p->min || p->min_occ != p)
43 __builtin_abort ();
45 __builtin_free (p);
46 return 0;