17 lines · cpp
1// REQUIRES: gwp_asan2// RUN: %clangxx_gwp_asan %s -o %t3// RUN: %expect_crash %run %t 2>&1 | FileCheck %s4 5// CHECK: GWP-ASan detected a memory error6// CHECK: Invalid (Wild) Free at 0x{{[a-f0-9]+}} (1 byte to the left of a7// CHECK-SAME: 1-byte allocation8 9#include <cstdlib>10 11int main() {12 char *Ptr =13 reinterpret_cast<char *>(malloc(1));14 free(Ptr - 1);15 return 0;16}17