Skip to content
Snippets Groups Projects
Commit f72c8918 authored by Jakub Jelinek's avatar Jakub Jelinek
Browse files

ubsan: Add another testcase for [0] array in the middle of struct [PR108894]

I think it is useful to cover also this, rather than just arrays at the
flexible array member positions.

2023-03-01  Jakub Jelinek  <jakub@redhat.com>

	PR sanitizer/108894
	* c-c++-common/ubsan/bounds-16.c: New test.
parent 520403f3
No related branches found
No related tags found
No related merge requests found
/* PR sanitizer/108894 */
/* { dg-do run } */
/* { dg-options "-fsanitize=bounds -fsanitize-recover=bounds" } */
/* { dg-output "index 1 out of bounds for type 'int \\\[\[*0-9x]*\\\]'\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*index 0 out of bounds for type 'int \\\[\[*0-9x]*\\\]'" } */
struct S { int a; int b[0]; int c; } s;
int
main ()
{
int *volatile p = &s.b[0];
p = &s.b[1];
int volatile q = s.b[0];
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment