gcc/testsuite/gcc.dg/pr109970.c
raw| 1 | /* PR109970 |
| 2 | * { dg-do compile } |
| 3 | * { dg-options "-Wstringop-overflow" } |
| 4 | * */ |
| 5 | |
| 6 | void bar(int x, char buf[x]); |
| 7 | void foo(int x; char buf[x], int x); |
| 8 | |
| 9 | int main() |
| 10 | { |
| 11 | char buf[10]; |
| 12 | bar(11, buf); /* { dg-warning "accessing 11 bytes in a region of size 10" } */ |
| 13 | foo(buf, 11); /* { dg-warning "accessing 11 bytes in a region of size 10" } */ |
| 14 | } |
| 15 |