[LVI] Add trunc to i1 handling. (#124480)
[llvm-project.git] / compiler-rt / test / asan / TestCases / Posix / ioctl.cpp
blob01e9843619b7f17ae67e618ae51907613259c64f
1 // RUN: %clangxx_asan -O0 -g %s -o %t && %env_asan_opts=handle_ioctl=1 not %run %t 2>&1 | FileCheck %s
2 // RUN: %clangxx_asan -O3 -g %s -o %t && %env_asan_opts=handle_ioctl=1 not %run %t 2>&1 | FileCheck %s
4 // RUN: %clangxx_asan -O0 -g %s -o %t && %run %t
5 // RUN: %clangxx_asan -O3 -g %s -o %t && %run %t
7 #include <assert.h>
8 #include <stdlib.h>
9 #include <sys/ioctl.h>
10 #include <sys/socket.h>
11 #include <unistd.h>
13 #if defined(__sun__) && defined(__svr4__)
14 #include <sys/filio.h>
15 #endif
17 int main(int argc, char **argv) {
18 int fd = socket(AF_UNIX, SOCK_DGRAM, 0);
20 int nonblock;
21 int res = ioctl(fd, FIONBIO, &nonblock + 1);
22 // CHECK: AddressSanitizer: stack-buffer-overflow
23 // CHECK: READ of size 4 at
24 // CHECK: {{#.* in main .*ioctl.cpp:}}[[@LINE-3]]
25 assert(res == 0);
26 close(fd);
27 return 0;