Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / tsan / munmap_invalid.cpp
blob07dc5bdf7f35a05157fdd5c676251793694bb407
1 // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
3 // Fails on Darwin bots:
4 // https://green.lab.llvm.org/green//job/clang-stage1-RA/25954/consoleFull
5 // and on clang-s390x-linux-lnt:
6 // https://lab.llvm.org/buildbot#builders/45/builds/5224
7 // Presumably the test is not 100% legal and kernel is allowed
8 // to unmap part of the range (e.g. .text) and then fail.
9 // So let's be conservative:
10 // REQUIRES: linux, x86_64-target-arch
12 #include "test.h"
13 #include <sys/mman.h>
15 int main() {
16 // These bogus munmap's must not crash tsan runtime.
17 munmap(0, 1);
18 munmap(0, -1);
19 munmap((void *)main, -1);
20 void *p =
21 mmap(0, 4096, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0);
22 munmap(p, (1ull << 60));
23 munmap(p, -10000);
24 munmap(p, 0);
25 fprintf(stderr, "DONE\n");
26 return 0;
29 // CHECK: DONE