2015-09-24 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / pr61964.c
bloba03cfdc37bd33c430de7a52ea4b3d73e8a66eaa9
1 /* { dg-do run } */
3 extern void abort (void);
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];
10 static int __attribute__((noinline))
11 foo()
13 node.prev = (void *)head;
14 head->first = &node;
16 struct node *n = head->first;
17 struct head *h = &heads[k];
19 if (n->prev == (void *)h)
20 h->first = n->next;
21 else
22 n->prev->next = n->next;
24 n->next = h->first;
25 return n->next == &node;
28 int main()
30 if (foo ())
31 abort ();
32 return 0;