Debian Codegraph @

gcc/testsuite/g++.dg/opt/pr101597.C

raw
1 // PR c++/101597
2 // { dg-do compile }
3 // { dg-options "-O2 -Warray-bounds" }
4
5 typedef __SIZE_TYPE__ size_t;
6 struct S { virtual void *foo (size_t) __attribute__((alloc_size (2))); };
7
8 int
9 foo (void *p)
10 {
11 char *q = static_cast<char *> (static_cast<S *> (p)->foo (32));
12 return q[64]; // { dg-warning "array subscript 64 is outside array bounds of" }
13 }