]> git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/tsan/Darwin/realloc-zero.cc
New upstream version 1.19.0+dfsg1
[rustc.git] / src / compiler-rt / test / tsan / Darwin / realloc-zero.cc
1 // Test that realloc(nullptr, 0) return a non-NULL pointer.
2
3 // RUN: %clang_tsan %s -o %t
4 // RUN: %run %t 2>&1 | FileCheck %s
5
6 #include <malloc/malloc.h>
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <sys/mman.h>
10
11 int main() {
12 void *p = realloc(NULL, 0);
13 if (!p) {
14 abort();
15 }
16 fprintf(stderr, "Okay.\n");
17 return 0;
18 }
19
20 // CHECK: Okay.