Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/analyzer/cstdlib.C @ 152:2b5abeee2509
update gcc11
author | anatofuz |
---|---|
date | Mon, 25 May 2020 07:50:57 +0900 |
parents | |
children |
rev | line source |
---|---|
152 | 1 #include <cstdlib> |
2 | |
3 void test_1 (void *ptr) | |
4 { | |
5 std::free (ptr); /* { dg-message "first 'free' here" } */ | |
6 std::free (ptr); /* { dg-warning "double-'free' of 'ptr'" } */ | |
7 } | |
8 | |
9 void test_2 (void) | |
10 { | |
11 void *p = std::malloc (1024); /* { dg-message "allocated here" } */ | |
12 } /* { dg-warning "leak of 'p'" } */ | |
13 | |
14 void test_3 (void) | |
15 { | |
16 void *p = std::calloc (42, 1024); /* { dg-message "allocated here" } */ | |
17 } /* { dg-warning "leak of 'p'" } */ |