Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / asan / TestCases / Darwin / malloc_zone-protected.cpp
blob125b544724d3fcfe99cbeb8f9eec088b4844c139
1 // Make sure the zones created by malloc_create_zone() are write-protected.
2 #include <malloc/malloc.h>
3 #include <stdio.h>
5 // RUN: %clangxx_asan %s -o %t
6 // RUN: ASAN_OPTIONS="abort_on_error=1" not --crash %run %t 2>&1 | FileCheck %s
9 void *pwn(malloc_zone_t *unused_zone, size_t unused_size) {
10 printf("PWNED\n");
11 return NULL;
14 int main() {
15 malloc_zone_t *zone = malloc_create_zone(0, 0);
16 zone->malloc = pwn;
17 void *v = malloc_zone_malloc(zone, 1);
18 // CHECK-NOT: PWNED
19 return 0;