aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/analyzer/pr94851-4.c
blob: d05d45876c9c5fbd5ba6b04b704de7667db89c78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* { dg-additional-options "-O2 -Wno-analyzer-symbol-too-complex" } */
/* { dg-skip-if "requires hosted libstdc++ for stdlib free" { ! hostedlib } } */

#include <stdlib.h>

struct List {
    struct List *next;
};

void foo(struct List *p, struct List *q)
{
    while (p && p != q){
        struct List *next = p->next;
        free(p);
        p = next;
    }
}

int main()
{
    struct List x = {0};
    foo(NULL, &x);
    return 0;
}