Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/malloc-ipa-6.c

raw
1 /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
2
3 #include <stdlib.h>
4
5 void *
6 calls_malloc (void)
7 {
8 void *result = malloc (1024); /* { dg-message "allocated here" } */
9 return result; /* { dg-warning "leak of 'result'" } */
10 }
11
12 void test_1 ()
13 {
14 calls_malloc (); /* { dg-message "calling 'calls_malloc' from 'test_1'" } */
15 }
16
17 static void callee (int i)
18 {
19 }
20
21 void test_2 (int i)
22 {
23 callee (i);
24 }