aboutsummaryrefslogtreecommitdiff
path: root/lib/asan/output_tests/null_deref.cc
blob: c152a4202e33c867329f46c9f2d6d4fa383c9c7e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
__attribute__((noinline))
static void NullDeref(int *ptr) {
  ptr[10]++;
}
int main() {
  NullDeref((int*)0);
}

// Check-Common: {{.*ERROR: AddressSanitizer crashed on unknown address}}
// Check-Common:   {{0x0*00028 .*pc 0x.*}}
// Check-Common: {{AddressSanitizer can not provide additional info. ABORTING}}

// atos on Mac cannot extract the symbol name correctly.
// Check-Linux: {{    #0 0x.* in NullDeref.*null_deref.cc:3}}
// Check-Darwin: {{    #0 0x.* in .*NullDeref.*null_deref.cc:3}}

// Check-Common: {{    #1 0x.* in main.*null_deref.cc:6}}