diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/analyzer/pr104308.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/analyzer/pr104308.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr104308.c b/gcc/testsuite/gcc.dg/analyzer/pr104308.c index 9cd5ee6feee..a3a0cbb7317 100644 --- a/gcc/testsuite/gcc.dg/analyzer/pr104308.c +++ b/gcc/testsuite/gcc.dg/analyzer/pr104308.c @@ -1,8 +1,19 @@ +/* Verify that we have source locations for + -Wanalyzer-use-of-uninitialized-value warnings involving folded + memory ops. */ + #include <string.h> -int main() +int test_memmove_within_uninit (void) { char s[5]; /* { dg-message "region created on stack here" } */ memmove(s, s + 1, 2); /* { dg-warning "use of uninitialized value" } */ return 0; } + +int test_memcpy_from_uninit (void) +{ + char a1[5]; + char a2[5]; /* { dg-message "region created on stack here" } */ + return (memcpy(a1, a2, 5) == a1); /* { dg-warning "use of uninitialized value" } */ +} |