Debian Codegraph @

gcc/testsuite/gcc.dg/plugin/infoleak-uninit-size-2.c

raw
1 /* Reduced from infoleak ICE seen on Linux kernel with
2 -Wno-analyzer-use-of-uninitialized-value.
3
4 Verify that we complain about the uninit value when
5 -Wno-analyzer-use-of-uninitialized-value isn't supplied. */
6
7 /* { dg-do compile } */
8 /* { dg-options "-fanalyzer" } */
9 /* { dg-require-effective-target analyzer } */
10
11 extern unsigned long
12 copy_to_user(void* to, const void* from, unsigned long n);
13
14 unsigned long
15 test_uninit_size (void *to, void *from)
16 {
17 unsigned long n;
18 char buf[16];
19 return copy_to_user(to, from, n); /* { dg-warning "use of uninitialized value 'n'" } */
20 }