[docs] Fix build-docs.sh
[llvm-project.git] / compiler-rt / test / lsan / TestCases / realloc_too_big.c
blobbb1316024b5cb8ad55b2788fe2fc3ef5c8912e48
1 // RUN: %clang_lsan %s -o %t
2 // RUN: %env_lsan_opts=allocator_may_return_null=1:max_allocation_size_mb=1:use_stacks=0 not %run %t 2>&1 | FileCheck %s
4 /// Fails when only leak sanitizer is enabled
5 // UNSUPPORTED: arm-linux, armhf-linux
7 #include <assert.h>
8 #include <stdio.h>
9 #include <stdlib.h>
11 // CHECK: {{Leak|Address}}Sanitizer failed to allocate 0x100001 bytes
13 // CHECK: {{Leak|Address}}Sanitizer: detected memory leaks
14 // CHECK: {{Leak|Address}}Sanitizer: 9 byte(s) leaked in 1 allocation(s).
16 int main() {
17 char *p = malloc(9);
18 fprintf(stderr, "nine: %p\n", p);
19 assert(realloc(p, 0x100001) == NULL); // 1MiB+1
20 p = 0;