aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-pr114472.c
blob: ef9e7711a2e4669fa5f4eca0440c5fca467f5f9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* Verify we don't ICE on cases involving very large values for size.  */

char s, d;

void
foo(void)
{
  __builtin_strncpy(&d, &s + 3, -1); /* { dg-warning "Wstringop-overflow" } */
  __builtin_strncpy(&d + 3, &s, -1); /* { dg-warning "Wstringop-overflow" } */
}

void
bar(void)
{
  __builtin_strncpy(&d, &s - 3, -1); /* { dg-warning "Wstringop-overflow" } */
  __builtin_strncpy(&d - 3, &s, -1); /* { dg-warning "Wstringop-overflow" } */
}