| 1 |
/* { dg-do run } */ |
| 2 |
|
| 3 |
extern void abort (void); |
| 4 |
|
| 5 |
struct node { struct node *next, *prev; } node; |
| 6 |
struct head { struct node *first; } heads[5]; |
| 7 |
int k = 2; |
| 8 |
struct head *head = &heads[2]; |
| 9 |
|
| 10 |
static int __attribute__((noinline)) |
| 11 |
foo() |
| 12 |
{ |
| 13 |
node.prev = (void *)head; |
| 14 |
head->first = &node; |
| 15 |
|
| 16 |
struct node *n = head->first; |
| 17 |
struct head *h = &heads[k]; |
| 18 |
|
| 19 |
if (n->prev == (void *)h) |
| 20 |
h->first = n->next; |
| 21 |
else |
| 22 |
n->prev->next = n->next; |
| 23 |
|
| 24 |
n->next = h->first; |
| 25 |
return n->next == &node; |
| 26 |
} |
| 27 |
|
| 28 |
int main() |
| 29 |
{ |
| 30 |
if (foo ()) |
| 31 |
abort (); |
| 32 |
return 0; |
| 33 |
} |