[ASan] mark ioctl test as xfailing on darwin. remove redundant semicolons
[blocksruntime.git] / lib / asan / lit_tests / TestCases / ioctl.cc
blobbf2772d988fa7b051a10ceb1896b461724b57f91
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
8 // XFAIL: darwin
10 #include <assert.h>
11 #include <stdlib.h>
12 #include <sys/ioctl.h>
13 #include <sys/socket.h>
14 #include <unistd.h>
16 int main(int argc, char **argv) {
17 int fd = socket(AF_INET, SOCK_DGRAM, 0);
19 int nonblock;
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]]
24 assert(res == 0);
25 close(fd);
26 return 0;