Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/pr104308.c

raw
1 /* Verify that we have source locations for
2 -Wanalyzer-use-of-uninitialized-value warnings involving folded
3 memory ops. */
4
5 #include <string.h>
6
7 int test_memmove_within_uninit (void)
8 {
9 char s[5]; /* { dg-message "region created on stack here" } */
10 memmove(s, s + 1, 2); /* { dg-warning "use of uninitialized value" } */
11 return 0;
12 }
13
14 int test_memcpy_from_uninit (void)
15 {
16 char a1[5];
17 char a2[5]; /* { dg-message "region created on stack here" } */
18 return (memcpy(a1, a2, 5) == a1); /* { dg-warning "use of uninitialized value" } */
19 }