diff options
author | Aaron Sawdey <acsawdey@gcc.gnu.org> | 2017-02-20 11:09:40 -0600 |
---|---|---|
committer | Aaron Sawdey <acsawdey@gcc.gnu.org> | 2017-02-20 11:09:40 -0600 |
commit | f05df2ac59209394588ac62b629bb9c190029a50 (patch) | |
tree | 9e2912eb25b7e907a134909eb7037fa6138ed6dc | |
parent | 027a9dd50982526525b9793646ef1e3d958869f2 (diff) | |
download | gcc-f05df2ac59209394588ac62b629bb9c190029a50.zip gcc-f05df2ac59209394588ac62b629bb9c190029a50.tar.gz gcc-f05df2ac59209394588ac62b629bb9c190029a50.tar.bz2 |
strncmp-2.c: Portability fixes.
2017-02-14 Aaron Sawdey <acsawdey@linux.vnet.ibm.com>
* gcc.dg/strncmp-2.c: Portability fixes.
From-SVN: r245608
-rw-r--r-- | gcc/testsuite/gcc.dg/strncmp-2.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/testsuite/gcc.dg/strncmp-2.c b/gcc/testsuite/gcc.dg/strncmp-2.c index 0c9a07a..ed6c5fa 100644 --- a/gcc/testsuite/gcc.dg/strncmp-2.c +++ b/gcc/testsuite/gcc.dg/strncmp-2.c @@ -19,7 +19,12 @@ static void test_driver_strncmp (void (test_strncmp)(const char *, const char *, { long pgsz = sysconf(_SC_PAGESIZE); char buf1[sz+1]; - char *buf2 = aligned_alloc(pgsz,2*pgsz); + char *buf2; +#if _POSIX_C_SOURCE >= 200112L + if ( posix_memalign ((void **)&buf2, pgsz, 2*pgsz) ) abort (); +#else + if ( !(buf2 = valloc(2*pgsz))) abort (); +#endif char *p2; int r,i,e; @@ -35,6 +40,7 @@ static void test_driver_strncmp (void (test_strncmp)(const char *, const char *, e = lib_memcmp(buf1,p2,sz); (*test_memcmp)(buf1,p2,e); } + free(buf2); } #define RUN_TEST(SZ) test_driver_strncmp (test_strncmp_ ## SZ, test_memcmp_ ## SZ, SZ); |