X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=libmudflap%2Ftestsuite%2Flibmudflap.c%2Fpass51-frag.c;fp=libmudflap%2Ftestsuite%2Flibmudflap.c%2Fpass51-frag.c;h=b830b3a869d944a3e4909e4832ddd3a01a65d658;hb=6fed43773c9b0ce596dca5686f37ac3fc0fa11c0;hp=0000000000000000000000000000000000000000;hpb=27b11d56b743098deb193d510b337ba22dc52e5c;p=msp430-gcc.git diff --git a/libmudflap/testsuite/libmudflap.c/pass51-frag.c b/libmudflap/testsuite/libmudflap.c/pass51-frag.c new file mode 100644 index 00000000..b830b3a8 --- /dev/null +++ b/libmudflap/testsuite/libmudflap.c/pass51-frag.c @@ -0,0 +1,41 @@ +/* Test object-spanning accesses. This is most conveniently done with + mmap, thus the config.h specificity here. */ +#include "../config.h" + +#include +#include +#ifdef HAVE_SYS_MMAN_H +#include +#endif + +int main () +{ +#ifndef MAP_ANONYMOUS +#define MAP_ANONYMOUS MAP_ANON +#endif +#ifdef HAVE_MMAP + void *p; + unsigned pg = getpagesize (); + int rc; + + p = mmap (NULL, 4 * pg, PROT_READ|PROT_WRITE, + MAP_PRIVATE|MAP_ANONYMOUS, 0, 0); + if (p == NULL) + return 1; + + memset (p, 0, 4*pg); + rc = munmap (p, pg); + if (rc < 0) return 1; + memset (p+pg, 0, 3*pg); + rc = munmap (p+pg, pg); + if (rc < 0) return 1; + memset (p+2*pg, 0, 2*pg); + rc = munmap (p+2*pg, pg); + if (rc < 0) return 1; + memset (p+3*pg, 0, pg); + rc = munmap (p+3*pg, pg); + if (rc < 0) return 1; +#endif + + return 0; +}