// RUN: %clang %s -emit-llvm %O0opt -c -o %t.bc // RUN: rm -rf %t.klee-out // RUN: %klee --output-dir=%t.klee-out --exit-on-error --posix-runtime %t.bc --sym-files 1 8 >%t.log #include #include #include #include #include #include int main(int argc, char** argv) { char buf[32]; // If count is zero, read() returns zero and has no other results. (man page) int x = read(0, 0, 0); assert(x == 0); int fd = open("A", O_RDONLY); assert(fd != -1); // EFAULT buf is outside your accessible address space. (man page) x = read(fd, 0, 1); assert(x == -1 && errno == EFAULT); // EBADF fd is not a valid file descriptor (man page) x = read(-1, buf, 1); assert(x == -1 && errno == EBADF); fd = open("A", O_RDONLY); assert(fd != -1); x = read(fd, buf, 1); assert(x == 1); }