Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / msan / Linux / forkpty.cpp
blobc5f09f0b843ff1f2dfe0effdc6124ae68ec77a54
1 // RUN: %clangxx_msan -O0 -g %s -lutil -o %t && %run %t
3 #include <assert.h>
4 #include <pty.h>
5 #include <unistd.h>
6 #include <cstring>
8 #include <sanitizer/msan_interface.h>
10 int
11 main (int argc, char** argv)
13 int parent, worker;
14 openpty(&parent, &worker, NULL, NULL, NULL);
15 assert(__msan_test_shadow(&parent, sizeof(parent)) == -1);
16 assert(__msan_test_shadow(&worker, sizeof(worker)) == -1);
18 char name[255];
19 ttyname_r(parent, name, sizeof(name));
20 assert(__msan_test_shadow(name, strlen(name) + 1) == -1);
22 char *name_p = ttyname(parent);
23 assert(__msan_test_shadow(name_p, strlen(name_p) + 1) == -1);
25 int parent2;
26 forkpty(&parent2, NULL, NULL, NULL);
27 assert(__msan_test_shadow(&parent2, sizeof(parent2)) == -1);