brintos

brintos / llvm-project-archived public Read only

0
0
Text · 987 B · 3ccb475 Raw
27 lines · cpp
1// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s2// RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s3// RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s4// RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s5 6#include "defines.h"7 8ATTRIBUTE_NOINLINE9// FIXME: Static symbols don't show up in PDBs. We can remove this once we start10// using DWARF.11#ifndef _MSC_VER12static13#endif14void NullDeref(int *ptr) {15  // CHECK: ERROR: AddressSanitizer: {{SEGV|access-violation}} on unknown address16  // CHECK:   {{0x0*000.. .*pc 0x.*}}17  ptr[10]++;  // BOOM18  // atos on Mac cannot extract the symbol name correctly. Also, on FreeBSD 9.219  // the demangling function rejects local names with 'L' in front of them.20  // CHECK: {{    #0 0x.* in .*NullDeref.*null_deref.cpp}}21}22int main() {23  NullDeref((int*)0);24  // CHECK: {{    #1 0x.* in main.*null_deref.cpp}}25  // CHECK: AddressSanitizer can not provide additional info.26}27