Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/error-uninit.c

raw
1 /* Verify that we check for uninitialized values passed to functions
2 that we have special-cased region-model handling for. */
3
4 extern void error (int __status, int __errnum, const char *__format, ...)
5 __attribute__ ((__format__ (__printf__, 3, 4)));
6
7 void test_uninit_status (int arg)
8 {
9 int st;
10 error (st, 42, "test: %s", arg); /* { dg-warning "use of uninitialized value 'st'" } */
11 }
12
13 void test_uninit_errnum (int st)
14 {
15 int num;
16 error (st, num, "test"); /* { dg-warning "use of uninitialized value 'num'" } */
17 }
18
19 void test_uninit_fmt (int st)
20 {
21 const char *fmt;
22 error (st, 42, fmt); /* { dg-warning "use of uninitialized value 'fmt'" } */
23 }
24
25 void test_uninit_vargs (int st)
26 {
27 int arg;
28 error (st, 42, "test: %s", arg); /* { dg-warning "use of uninitialized value 'arg'" } */
29 }