aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-pr110387.c
blob: b4454805eb5865ef2f192fe9ab94573cd60af34c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
char a, b, c, d;
long x;

void
_S_copy (long __n)
{
  __builtin_memcpy (&a, &d, __n); /* { dg-prune-output "-Wanalyzer-out-of-bounds" } */
  /* This only warns on some targets; the purpose of the test is to verify that
     we don't ICE.  */
}

void
_M_construct ()
{
  x = &c - &b; /* { dg-warning "undefined behavior when subtracting pointers" } */
  unsigned long __dnew = x;
  if (__dnew > 1)
    _S_copy (&c - &b); /* { dg-warning "undefined behavior when subtracting pointers" } */
}