Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/out-of-bounds-pr114472.c

raw
1 /* Verify we don't ICE on cases involving very large values for size. */
2
3 char s, d;
4
5 void
6 foo(void)
7 {
8 __builtin_strncpy(&d, &s + 3, -1); /* { dg-warning "Wstringop-overflow" } */
9 __builtin_strncpy(&d + 3, &s, -1); /* { dg-warning "Wstringop-overflow" } */
10 }
11
12 void
13 bar(void)
14 {
15 __builtin_strncpy(&d, &s - 3, -1); /* { dg-warning "Wstringop-overflow" } */
16 __builtin_strncpy(&d - 3, &s, -1); /* { dg-warning "Wstringop-overflow" } */
17 }