• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
2 // RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
3 // RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s
4 // RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
5 
6 __attribute__((noinline))
NullDeref(int * ptr)7 static void NullDeref(int *ptr) {
8   // CHECK: ERROR: AddressSanitizer: SEGV on unknown address
9   // CHECK:   {{0x0*000.. .*pc 0x.*}}
10   ptr[10]++;  // BOOM
11   // atos on Mac cannot extract the symbol name correctly. Also, on FreeBSD 9.2
12   // the demangling function rejects local names with 'L' in front of them.
13   // CHECK: {{    #0 0x.* in .*NullDeref.*null_deref.cc:}}[[@LINE-3]]
14 }
main()15 int main() {
16   NullDeref((int*)0);
17   // CHECK: {{    #1 0x.* in main.*null_deref.cc:}}[[@LINE-1]]
18   // CHECK: AddressSanitizer can not provide additional info.
19 }
20