| 1 |
/* PR bootstrap/82916 */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* { dg-options "-O2 -fno-tree-dse" } */ |
| 4 |
|
| 5 |
struct A { struct A *next; }; |
| 6 |
struct C |
| 7 |
{ |
| 8 |
int *of; |
| 9 |
struct C *parent, *prev, *next; |
| 10 |
int depth; |
| 11 |
int min; |
| 12 |
struct C *min_occ; |
| 13 |
}; |
| 14 |
|
| 15 |
__attribute__((noipa)) struct C * |
| 16 |
foo (int *node) |
| 17 |
{ |
| 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; |
| 32 |
} |
| 33 |
|
| 34 |
int |
| 35 |
main () |
| 36 |
{ |
| 37 |
int o; |
| 38 |
struct C *p = foo (&o); |
| 39 |
if (p) |
| 40 |
{ |
| 41 |
if (p->of != &o || p->parent || p->prev || p->next || p->depth |
| 42 |
|| p->min || p->min_occ != p) |
| 43 |
__builtin_abort (); |
| 44 |
} |
| 45 |
__builtin_free (p); |
| 46 |
return 0; |
| 47 |
} |