aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/dump-state.c
blob: 618a5a9d7810f0949bc4ff2a5f856db95fb0911e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* Verify that __analyzer_dump_state works as expected.  */

#include <stdlib.h>
#include "analyzer-decls.h"

void test_1 (void)
{
  void *p = malloc (1024);
  __analyzer_dump_state ("malloc", p); /* { dg-warning "state: 'unchecked'" } */
  free (p);
  __analyzer_dump_state ("malloc", p); /* { dg-warning "state: 'freed'" } */
  __analyzer_dump_state (NULL, p); /* { dg-error "cannot determine state machine" } */
  __analyzer_dump_state ("not a state machine", p); /* { dg-error "unrecognized state machine 'not a state machine'" } */
}