Debian Codegraph @

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

raw
1 char a, b, c, d;
2 long x;
3
4 void
5 _S_copy (long __n)
6 {
7 __builtin_memcpy (&a, &d, __n); /* { dg-prune-output "-Wanalyzer-out-of-bounds" } */
8 /* This only warns on some targets; the purpose of the test is to verify that
9 we don't ICE. */
10 }
11
12 void
13 _M_construct ()
14 {
15 x = &c - &b; /* { dg-warning "undefined behavior when subtracting pointers" } */
16 unsigned long __dnew = x;
17 if (__dnew > 1)
18 _S_copy (&c - &b); /* { dg-warning "undefined behavior when subtracting pointers" } */
19 }