gcc/testsuite/c-c++-common/analyzer/malloc-meaning-1.c
raw| 1 | /* { dg-additional-options "-fanalyzer-verbose-state-changes" } */ |
| 2 | /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */ |
| 3 | |
| 4 | #include <stdlib.h> |
| 5 | |
| 6 | void test_1 (void) |
| 7 | { |
| 8 | void *ptr = malloc (1024); /* { dg-message "meaning: \\{verb: 'acquire', noun: 'memory'\\}" } */ |
| 9 | free (ptr); /* { dg-message "meaning: \\{verb: 'release', noun: 'memory'\\}" } */ |
| 10 | free (ptr); /* { dg-warning "double-'free' of 'ptr'" } */ |
| 11 | } |