* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
[official-gcc.git] / gcc / testsuite / c-c++-common / ubsan / bounds-9.c
blob61c11f4b3b8a2f9439bbfab260b6ead5058f91e0
1 /* PR sanitizer/65280 */
2 /* { dg-do run } */
3 /* { dg-options "-fsanitize=bounds" } */
4 /* Origin: Martin Uecker <uecker@eecs.berkeley.edu> */
6 void
7 foo (volatile int (*a)[3])
9 (*a)[3] = 1; // error
10 a[0][0] = 1; // ok
11 a[1][0] = 1; // ok
12 a[1][4] = 1; // error
15 int
16 main ()
18 volatile int a[20];
19 foo ((int (*)[3]) &a);
20 return 0;
23 /* { dg-output "index 3 out of bounds for type 'int \\\[3\\\]'\[^\n\r]*(\n|\r\n|\r)" } */
24 /* { dg-output "\[^\n\r]*index 4 out of bounds for type 'int \\\[3\\\]'" } */