| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-fno-builtin-memset" } */ |
| 3 |
/* { dg-shouldfail "asan" } */ |
| 4 |
|
| 5 |
extern |
| 6 |
#ifdef __cplusplus |
| 7 |
"C" |
| 8 |
#endif |
| 9 |
void *memset (void *, int, __SIZE_TYPE__); |
| 10 |
|
| 11 |
volatile int ten = 10; |
| 12 |
|
| 13 |
int main() { |
| 14 |
char x[10]; |
| 15 |
memset(x, 0, 10); |
| 16 |
int res = x[ten]; /* BOOOM */ |
| 17 |
return res; |
| 18 |
} |
| 19 |
|
| 20 |
/* { dg-output "READ of size 1 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */ |
| 21 |
/* { dg-output " #0 0x\[0-9a-f\]+ +(in _*main (\[^\n\r]*stack-overflow-1.c:16|\[^\n\r]*:0|\[^\n\r]*\\+0x\[0-9a-z\]*)|\[(\]).*(\n|\r\n|\r)" } */ |
| 22 |
/* { dg-output "\[^\n\r]*Address 0x\[0-9a-f\]+ is located in stack of thread T0.*(\n|\r\n|\r)" */ |
| 23 |
/* { dg-output "\[^\n\r]*in main.*stack-overflow-1.c.*(\n|\r\n|\r)" */ |