1 // RUN: %clangxx_asan -O0 -g %s -o %t && ASAN_OPTIONS=handle_ioctl=1 %t 2>&1 | %symbolize | FileCheck %s
2 // RUN: %clangxx_asan -O3 -g %s -o %t && ASAN_OPTIONS=handle_ioctl=1 %t 2>&1 | %symbolize | FileCheck %s
4 // RUN: %clangxx_asan -O0 -g %s -o %t && %t
5 // RUN: %clangxx_asan -O3 -g %s -o %t && %t
7 // See https://code.google.com/p/address-sanitizer/issues/detail?id=195
12 #include <sys/ioctl.h>
13 #include <sys/socket.h>
16 int main(int argc
, char **argv
) {
17 int fd
= socket(AF_INET
, SOCK_DGRAM
, 0);
20 int res
= ioctl(fd
, FIONBIO
, &nonblock
+ 1);
21 // CHECK: AddressSanitizer: stack-buffer-overflow
22 // CHECK: READ of size 4 at
23 // CHECK: #{{.*}} in main {{.*}}/ioctl.cc:[[@LINE-3]]