[asan] use some LIKELY/UNLIKELY
[blocksruntime.git] / test / asan / TestCases / waitid.cc
blobedfe3ed72e6409d6ef514c1af573f4eda82f1a4a
1 // RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
2 // RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
4 #include <assert.h>
5 #include <sys/wait.h>
6 #include <unistd.h>
8 int main(int argc, char **argv) {
9 pid_t pid = fork();
10 if (pid) { // parent
11 int x[3];
12 int *status = x + argc * 3;
13 int res;
15 siginfo_t *si = (siginfo_t*)(x + argc * 3);
16 res = waitid(P_ALL, 0, si, WEXITED | WNOHANG);
17 // CHECK: stack-buffer-overflow
18 // CHECK: {{WRITE of size .* at 0x.* thread T0}}
19 // CHECK: {{in .*waitid}}
20 // CHECK: {{in main .*waitid.cc:}}
21 // CHECK: is located in stack of thread T0 at offset
22 // CHECK: {{in main}}
23 return res != -1;
25 // child
26 return 0;