Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/malloc-ipa-9.c

raw
1 /* { dg-additional-options "-fdiagnostics-path-format=none -fanalyzer-verbosity=1" } */
2 /* { dg-skip-if "requires hosted libstdc++ for stdlib free" { ! hostedlib } } */
3
4 #include <stdlib.h>
5
6 void
7 two_frees (void *p, void *q)
8 {
9 free (p);
10 free (q); /* { dg-warning "double-'free' of 'q'" } */
11 /* TODO: could be useful to identify that p == q when called from 'test'. */
12 }
13
14 extern void do_stuff (void);
15
16 void test (void *ptr)
17 {
18 two_frees (ptr, ptr);
19 }