2017-12-05 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr62167.c
blob7293d642d414e153a253cb1cfbced4bb4499a3cf
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 asm("":"=m"(node.prev));
34 head->first = &node;
36 struct node *n = head->first;
38 struct head *h = &heads[k];
40 heads[2].first = n->next;
42 if ((void*)n->prev == (void *)h)
43 p = h->first;
44 else
45 /* Dead tbaa-unsafe load from ((struct node *)&heads[2])->next. */
46 p = n->prev->next;
48 return !(p == (void*)0);
51 /* { dg-final { scan-tree-dump-not "Removing basic block" "pre"} } */