1 /* { dg-do compile } */ 2 /* { dg-options "-O2 -ftree-tail-merge -fdump-tree-pre" } */ 3 4 struct node 5 { 6 struct node *next; 7 struct node *prev; 8 }; 9 10 struct node node; 11 12 struct head 13 { 14 struct node *first; 15 }; 16 17 struct head heads[5]; 18 19 int k = 2; 20 21 struct head *head = &heads[2]; 22 23 int main()24main () 25 { 26 struct node *p; 27 28 node.next = (void*)0; 29 30 node.prev = (void *)head; 31 32 asm("":"=m"(node.prev)); 33 34 head->first = &node; 35 36 struct node *n = head->first; 37 38 struct head *h = &heads[k]; 39 40 heads[2].first = n->next; 41 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; 47 48 return !(p == (void*)0); 49 } 50 51 /* { dg-final { scan-tree-dump-not "Removing basic block" "pre"} } */ 52