| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -Wall -Wno-array-bounds" } */ |
| 3 |
|
| 4 |
#include "Wobjsize-1.h" |
| 5 |
|
| 6 |
char buf[6]; |
| 7 |
|
| 8 |
int main(int argc, char **argv) |
| 9 |
{ |
| 10 |
strcpy (buf,"hello "); |
| 11 |
return 0; |
| 12 |
} |
| 13 |
|
| 14 |
/* { dg-warning "\\\[-Wstringop-overflow" "warning" { target *-*-* } 0 } |
| 15 |
{ dg-message "file included" "included" { target *-*-* } 0 } |
| 16 |
{ dg-message "inlined from" "inlined" { target *-*-* } 0 } |
| 17 |
|
| 18 |
The test might emit two warnings, one for the strcpy call and |
| 19 |
another for the inlined call to __builtin___strcpy_chk() called |
| 20 |
from strcpy(). |
| 21 |
{ dg-prune-output "writing 7 bytes into a region of size 6" } */ |