1// If user provides his own libc functions, ASan doesn't
2// intercept these functions.
3
4// { dg-do run }
5// { dg-options "-fno-builtin-malloc -fno-builtin-free" }
6// { dg-additional-options "-D__NO_INLINE__" { target { *-*-linux-gnu } } }
7
8#include <stdlib.h>
9#include <stdio.h>
10
11extern "C" long strtol(const char *nptr, char **endptr, int base) {
12  fprintf(stderr, "my_strtol_interceptor\n");
13  return 0;
14}
15
16int main() {
17  char *x = (char*)malloc(10);
18  free(x);
19  return (int)strtol(x, 0, 10);
20}
21
22// { dg-output "my_strtol_interceptor" }
23