Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/pr94851-4.c

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