https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65280
Bug ID: 65280
Summary: -fsanitize=bounds does not detect out-of-bounds access
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: mpolacek at gcc dot gnu.org
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org
void
foo (int n, int (*b)[n])
{
(*b)[n] = 1;
}
int
main ()
{
int a[20];
foo (3, (int (*)[3]) &a);
}
We issue no runtime error here, while clang says:
u.c:5:2: runtime error: index 3 out of bounds for type 'int [n]'