ppc64: Arguments to iselInt128Expr_to_32x4 should be initialized.
[valgrind.git] / memcheck / tests / badpoll.c
blob61b8d31bb1468b397392cc933165350e75b74ecb
1 #include <assert.h>
2 #include <stdlib.h>
3 #include <sys/poll.h>
5 // At one point, poll()'s checking was not done accurately. This test
6 // exposes this -- previously Memcheck only found one error, now if finds
7 // two.
9 int main(void)
11 // Under-allocate by one byte so we get an addressability error.
12 struct pollfd* ufds = malloc(2 * sizeof(struct pollfd) - 1);
13 assert(ufds);
15 ufds[0].fd = 0;
16 ufds[0].events = 0;
17 //ufds[1].fd = 0; // leave undefined so we get another error.
18 ufds[1].events = 0;
20 // Previously, the bounds-error due to the under-allocation was detected,
21 // but not the undefined value error due to ufds[1].fd not being defined.
22 poll(ufds, 2, 200);
24 return 0;