1 #include "../../gcc.dg/analyzer/analyzer-decls.h"
3 extern void unknown_fn (void *);
5 static int only_used_by_test_1
;
7 static void test_1 (void)
10 __analyzer_dump_escaped (); /* { dg-warning "escaped: 0: " } */
13 __analyzer_dump_escaped (); /* { dg-warning "escaped: 0: " } */
15 unknown_fn (&local_1
);
16 __analyzer_dump_escaped (); /* { dg-warning "escaped: 1: 'local_1'" "" { target c } } */
17 /* { dg-warning "escaped: 1: 'int local_1'" "" { target c++ } .-1 } */
19 /* Should be idempotent. */
20 unknown_fn (&local_1
);
21 __analyzer_dump_escaped (); /* { dg-warning "escaped: 1: 'local_1'" "" { target c } } */
22 /* { dg-warning "escaped: 1: 'int local_1'" "" { target c++ } .-1 } */
24 /* Escape a static global. */
25 unknown_fn (&only_used_by_test_1
);
26 __analyzer_dump_escaped (); /* { dg-warning "escaped: 2: 'local_1', 'only_used_by_test_1'" "" { target c } } */
27 /* { dg-warning "escaped: 2: 'int local_1', 'int only_used_by_test_1'" "" { target c++ } .-1 } */