PR c/64440
[official-gcc.git] / gcc / testsuite / gcc.dg / pr62167.c
blobf8c31a0792f2f75d189ff4fbc23bf55c8a6dcb2a
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -ftree-tail-merge -fdump-tree-pre" } */
4 struct node
6 struct node *next;
7 struct node *prev;
8 };
10 struct node node;
12 struct head
14 struct node *first;
17 struct head heads[5];
19 int k = 2;
21 struct head *head = &heads[2];
23 int
24 main ()
26 struct node *p;
28 node.next = (void*)0;
30 node.prev = (void *)head;
32 head->first = &node;
34 struct node *n = head->first;
36 struct head *h = &heads[k];
38 heads[2].first = n->next;
40 if ((void*)n->prev == (void *)h)
41 p = h->first;
42 else
43 /* Dead tbaa-unsafe load from ((struct node *)&heads[2])->next. */
44 p = n->prev->next;
46 return !(p == (void*)0);
49 /* { dg-final { scan-tree-dump-not "Removing basic block" "pre"} } */
50 /* { dg-final { cleanup-tree-dump "pre" } } */