2014-07-29 Ed Smith-Rowland <3dw4rd@verizon.net>
[official-gcc.git] / gcc / testsuite / c-c++-common / asan / null-deref-1.c
blob87c34c4f68b5513f518361146db8b61cf39ec427
1 /* { dg-do run } */
2 /* { dg-options "-fno-omit-frame-pointer -fno-shrink-wrap" } */
3 /* { dg-additional-options "-mno-omit-leaf-frame-pointer" { target { i?86-*-* x86_64-*-* } } } */
4 /* { dg-shouldfail "asan" } */
6 __attribute__((noinline, noclone))
7 static void
8 NullDeref(int *ptr)
10 ptr[10]++;
13 int main()
15 NullDeref((int*)0);
16 return 0;
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\n|\r)" } */
21 /* { dg-output "\[^\n\r]* #0 0x\[0-9a-f\]+ (in \[^\n\r]*NullDeref\[^\n\r]* (\[^\n\r]*null-deref-1.c:10|\[^\n\r]*:0)|\[(\])\[^\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]*(\n|\r\n|\r)" } */