PR middle-end/85602 - -Wsizeof-pointer-memaccess for strncat with size of source
[official-gcc.git] / gcc / testsuite / gcc.dg / pr62030.c
blobb8baf934354c8042f26c77aa1fc2c8200662db23
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
4 extern void abort (void);
6 struct node
8 struct node *next;
9 struct node *prev;
12 struct node node;
14 struct head
16 struct node *first;
19 struct head heads[5];
21 int k = 2;
23 struct head *head = &heads[2];
25 static int __attribute__((noinline))
26 foo (void)
28 node.prev = (void *)head;
29 head->first = &node;
31 struct node *n = head->first;
32 struct head *h = &heads[k];
33 struct node *next = n->next;
35 if (n->prev == (void *)h)
36 h->first = next;
37 else
38 n->prev->next = next;
40 n->next = h->first;
41 return n->next == &node;
44 int
45 main (void)
47 if (foo ())
48 abort ();
49 return 0;