Debian Codegraph @

gcc/testsuite/gcc.dg/analyzer/pr99886.c

raw
1 /* Regression test for hang with -fanalyzer-verbosity=0. */
2 /* { dg-additional-options "-fanalyzer-verbosity=0" } */
3
4 #include <stdlib.h>
5
6 struct coord {
7 float x;
8 float y;
9 };
10
11 void test_34 (void)
12 {
13 float *q;
14 struct coord *p = malloc (sizeof (struct coord));
15 if (!p)
16 return;
17 p->x = 0.0f;
18 q = &p->x;
19 free (p);
20 *q = 1.0f; /* { dg-warning "use after 'free' of 'q'" } */
21 };