https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101597

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Testcase that reproduces even with current trunk (started also with r12-2132):

// PR c++/101597
// { dg-do compile }
// { dg-options "-O2 -Warray-bounds" }

typedef __SIZE_TYPE__ size_t;
struct S { virtual void *foo (size_t) __attribute__((alloc_size (2))); };

int
foo (void *p)
{
  char *q = static_cast<char *> (static_cast<S *> (p)->foo (32));
  return q[64];         // { dg-warning "array subscript 64 is outside array
bounds of" }
}

Reply via email to