aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/analyzer/error-uninit.c
blob: 8d52a177b113ad5aec7568db8a96604bfce68dc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* Verify that we check for uninitialized values passed to functions
   that we have special-cased region-model handling for.  */

extern void error (int __status, int __errnum, const char *__format, ...)
     __attribute__ ((__format__ (__printf__, 3, 4)));

void test_uninit_status (int arg)
{
  int st;
  error (st, 42, "test: %s", arg); /* { dg-warning "use of uninitialized value 'st'" } */
}

void test_uninit_errnum (int st)
{
  int num;
  error (st, num, "test"); /* { dg-warning "use of uninitialized value 'num'" } */
}

void test_uninit_fmt (int st)
{
  const char *fmt;
  error (st, 42, fmt); /* { dg-warning "use of uninitialized value 'fmt'" } */
}

void test_uninit_vargs (int st)
{
  int arg;
  error (st, 42, "test: %s", arg); /* { dg-warning "use of uninitialized value 'arg'" } */
}