Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/dump-state.c

raw
1 /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
2
3 /* Verify that __analyzer_dump_state works as expected. */
4
5 #include <stdlib.h>
6 #include "analyzer-decls.h"
7
8 void test_1 (void)
9 {
10 void *p = malloc (1024);
11 __analyzer_dump_state ("malloc", p); /* { dg-warning "state: 'unchecked'" } */
12 free (p);
13 __analyzer_dump_state ("malloc", p); /* { dg-warning "state: 'freed'" } */
14 __analyzer_dump_state (NULL, p); /* { dg-error "cannot determine state machine" } */
15 __analyzer_dump_state ("not a state machine", p); /* { dg-error "unrecognized state machine 'not a state machine'" } */
16 }