1 /* { dg-additional-options "-O2" } */
2
3 #include <stdlib.h>
4
5 struct List {
6 struct List *next;
7 };
8
9 void foo(struct List *p, struct List *q)
10 {
11 while (p && p != q){
12 struct List *next = p->next;
13 free(p);
14 p = next;
15 }
16 }
17
18 int main()
19 {
20 struct List x = {0};
21 foo(NULL, &x);
22 return 0;
23 }
24