| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-fno-omit-frame-pointer -fno-shrink-wrap -fno-ipa-modref" } */ |
| 3 |
/* { dg-additional-options "-mno-omit-leaf-frame-pointer" { target { i?86-*-* x86_64-*-* } } } */ |
| 4 |
/* { dg-shouldfail "asan" } */ |
| 5 |
|
| 6 |
__attribute__((noinline, noclone)) |
| 7 |
static void |
| 8 |
NullDeref(int *ptr) |
| 9 |
{ |
| 10 |
ptr[10]++; |
| 11 |
} |
| 12 |
|
| 13 |
int main() |
| 14 |
{ |
| 15 |
NullDeref((int*)0); |
| 16 |
return 0; |
| 17 |
} |
| 18 |
|
| 19 |
/* { dg-output "ERROR: AddressSanitizer:? SEGV on unknown address\[^\n\r]*" } */ |
| 20 |
/* { dg-output "0x\[0-9a-f\]+ \[^\n\r]*pc 0x\[0-9a-f\]+.*(\n|\r\n|\r)" } */ |
| 21 |
/* { dg-output " #0 0x\[0-9a-f\]+ +(in \[^\n\r]*NullDeref\[^\n\r]* (\[^\n\r]*null-deref-1.c:10|\[^\n\r]*:0|\[^\n\r]*\\+0x\[0-9a-z\]*)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */ |
| 22 |
/* { dg-output " #1 0x\[0-9a-f\]+ +(in _*main (\[^\n\r]*null-deref-1.c:15|\[^\n\r]*:0|\[^\n\r]*\\+0x\[0-9a-z\]*)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */ |