configure: drop -flto-partition=one
[valgrind.git] / memcheck / tests / badpoll.c
blobbeae44aa3179db190fd36040ce2218d1f04c6c72
1 #include <assert.h>
2 #include <stdlib.h>
3 #include <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;