(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
pr62167-run.c
       1  /* { dg-do run } */
       2  /* { dg-options "-O2 -ftree-tail-merge" } */
       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
      24  main ()
      25  {
      26    struct node *p;
      27  
      28    node.next = (void*)0;
      29  
      30    node.prev = (void *)head;
      31  
      32    head->first = &node;
      33  
      34    struct node *n = head->first;
      35  
      36    struct head *h = &heads[k];
      37  
      38    heads[2].first = n->next;
      39  
      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;
      45  
      46    return !(p == (void*)0);
      47  }