Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / testsuite / g++.dg / asan / symbolize-callback-1.C
1 // { dg-do run }
2 // { dg-skip-if "" { *-*-* }  { "*" } { "-O2" } }
3 // { dg-options "-fno-builtin-malloc -fno-builtin-free" }
4 // { dg-shouldfail "asan" }
5
6 #include <stdio.h>
7 #include <stdlib.h>
8
9 extern "C"
10 bool __asan_symbolize(const void *, char *out_buffer, int out_size) {
11   snprintf(out_buffer, out_size, "MySymbolizer");
12   return true;
13 }
14
15 int main() {
16   char *x = (char*)malloc(10);
17   free(x);
18   return x[5];
19 }
20
21 // { dg-output "MySymbolizer" }