Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/malloc-dce.c

raw
1 /* { dg-additional-options "-O2" } */
2 /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
3
4 #include <stdlib.h>
5
6 void test(void)
7 {
8 void *ptr = malloc(512);
9 free(ptr);
10 free(ptr); /* { dg-warning "double-'free'" "" { xfail *-*-* } } */
11 }
12 /* With optimization, the whole of test() goes away in the "cddce" pass
13 before the analysis pass sees it, and hence we get no error message. */