aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/plugin/infoleak-uninit-size-2.c
blob: a8a383f4b2d391e55c34abae862901061ed5f937 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* Reduced from infoleak ICE seen on Linux kernel with
   -Wno-analyzer-use-of-uninitialized-value.

   Verify that we complain about the uninit value when
   -Wno-analyzer-use-of-uninitialized-value isn't supplied.  */

/* { dg-do compile } */
/* { dg-options "-fanalyzer" } */
/* { dg-require-effective-target analyzer } */

extern unsigned long
copy_to_user(void* to, const void* from, unsigned long n);

unsigned long
test_uninit_size (void *to, void *from)
{
  unsigned long n;
  char buf[16];
  return copy_to_user(to, from, n); /* { dg-warning "use of uninitialized value 'n'" } */
}