1 /* PR sanitizer/70875 */ 2 /* { dg-do run } */ 3 /* { dg-options "-fsanitize=bounds -fno-sanitize-recover=bounds" } */ 4 /* { dg-shouldfail "ubsan" } */ 5 6 int foo(int n,int k)7foo (int n, int k) 8 { 9 struct S 10 { 11 int i[n]; 12 int value; 13 } s[2]; 14 return s[k].value = 0; 15 } 16 17 int main()18main () 19 { 20 return foo (2, 2); 21 } 22 23 /* { dg-output "index 2 out of bounds for type 'S \\\[2\\\]'" } */ 24