From bd5159bdd4f26ea6e01c1411149e8e2eaec62531 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Sat, 13 Nov 2021 11:58:09 +0000 Subject: [PATCH] testsuite, Darwin: In tsvc.h, use malloc for Darwin <= 9. Earlier Darwin versions fdo not have posix_memalign() but the malloc implementation is guaranteed to produce memory suitably aligned for the largest vector type. Signed-off-by: Iain Sandoe gcc/testsuite/ChangeLog: * gcc.dg/vect/tsvc/tsvc.h: Use malloc for Darwin 9 and earlier. --- gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h b/gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h index 63ea1e2..665ca74 100644 --- a/gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h +++ b/gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h @@ -193,8 +193,16 @@ void init(int** ip, real_t* s1, real_t* s2){ xx = (real_t*) memalign(ARRAY_ALIGNMENT, LEN_1D*sizeof(real_t)); *ip = (int *) memalign(ARRAY_ALIGNMENT, LEN_1D*sizeof(real_t)); #else +# if defined (__APPLE__) \ + && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1060 + /* We have no aligned allocator, but malloc is guaranteed to return + alignment suitable for the largest vector item. */ + xx = (real_t*) malloc (LEN_1D*sizeof(real_t)); + *ip = (int *) malloc (LEN_1D*sizeof(real_t)); +# else posix_memalign ((void*)&xx, ARRAY_ALIGNMENT, LEN_1D*sizeof(real_t)); posix_memalign ((void*)ip, ARRAY_ALIGNMENT, LEN_1D*sizeof(real_t)); +# endif #endif for (int i = 0; i < LEN_1D; i = i+5){ -- 2.7.4