23 lines · cpp
1// Ensure that output is the same but exit code depends on halt_on_error value2// RUN: %clangxx_asan %s -o %t3// RUN: %env_asan_opts="halt_on_error=0" %run %t 2>&1 | FileCheck %s4// RUN: %env_asan_opts="halt_on_error=1" not %run %t 2>&1 | FileCheck %s5// RUN: not %run %t 2>&1 | FileCheck %s6// REQUIRES: leak-detection7// UNSUPPORTED: android 8 9#include <stdlib.h>10 11int f() {12 volatile int *a = (int *)malloc(20);13 a[0] = 1;14 return a[0];15}16 17int main() {18 f();19 f();20}21 22// CHECK: LeakSanitizer: detected memory leaks23