brintos

brintos / llvm-project-archived public Read only

0
0
Text · 415 B · c38a36f Raw
22 lines · cpp
1// RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s2 3#include <stdio.h>4#include <stdlib.h>5 6// Required for dyld macOS 12.0+7#if (__APPLE__)8__attribute__((weak))9#endif10extern "C" void11__asan_on_error() {12  fprintf(stderr, "__asan_on_error called\n");13  fflush(stderr);14}15 16int main() {17  char *x = (char*)malloc(10 * sizeof(char));18  free(x);19  return x[5];20  // CHECK: __asan_on_error called21}22