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 
main()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.
21