]>
git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/asan/TestCases/Posix/wait4.cc
1 // RUN: %clangxx_asan -DWAIT4 -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
2 // RUN: %clangxx_asan -DWAIT4 -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
4 // RUN: %clangxx_asan -DWAIT4_RUSAGE -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
5 // RUN: %clangxx_asan -DWAIT4_RUSAGE -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
13 int main(int argc
, char **argv
) {
14 // This test passes on some versions of Android NDK and fails on other.
15 // https://code.google.com/p/memory-sanitizer/issues/detail?id=64
16 // Make it fail unconditionally on Android.
24 int *status
= x
+ argc
* 3;
27 res
= wait4(pid
, status
, WNOHANG
, NULL
);
28 #elif defined(WAIT4_RUSAGE)
29 struct rusage
*ru
= (struct rusage
*)(x
+ argc
* 3);
31 res
= wait4(pid
, &good_status
, WNOHANG
, ru
);
33 // CHECK: stack-buffer-overflow
34 // CHECK: {{WRITE of size .* at 0x.* thread T0}}
35 // CHECK: {{in .*wait}}
36 // CHECK: {{in main .*wait4.cc:}}
37 // CHECK: is located in stack of thread T0 at offset
39 return res
== -1 ? 1 : 0;