Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / ubsan / vla-1.C
blob81e93e3b7ad34eebaa27c3637639a2866b0fdf6c
1 // { dg-do run }
2 // { dg-options "-Wno-vla -Wno-stringop-overflow -fsanitize=undefined" }
3 // { dg-output "index 1 out of bounds" }
5 void f(int i)
7   /* The following creates an array of char[4] on the stack and
8      the initialization triggers a -Wstringop-overflow with LTO
9      (or when the function is inlined into the called, such as
10      with -fwhole-program).  See PR91258.  The warning is
11      suppressed above.  */
12   int ar[i] = { 42, 24 };
15 int main()
17   f(1);