public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Iain D Sandoe <iains@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-4958] testsuite, Darwin : Fix tsvc test build on Darwin.
Date: Fri,  5 Nov 2021 21:07:06 +0000 (GMT)	[thread overview]
Message-ID: <20211105210706.76155385840A@sourceware.org> (raw)

https://gcc.gnu.org/g:8f4860f956871c3fd77ed60567d707490104f370

commit r12-4958-g8f4860f956871c3fd77ed60567d707490104f370
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Fri Nov 5 19:19:53 2021 +0000

    testsuite, Darwin : Fix tsvc test build on Darwin.
    
    Currently all the tsvc tests fail to build on Darwin because
    they assume that <malloc.h> and memalign() are available.
    
    For Darwin, <stdlib.h> is sufficient to obtain the declarations
    for malloc and the port has posix_memalign () but not memalign.
    
    Fixed as below.
    
    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
    
    gcc/testsuite/ChangeLog:
    
            * gcc.dg/vect/tsvc/tsvc.h: Do not try to include malloc.h
            on Darwin also use posix_memalign ().

Diff:
---
 gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h b/gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h
index b52108dae9f..5dd9ca91040 100644
--- a/gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h
+++ b/gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h
@@ -11,7 +11,9 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#ifndef __APPLE__
 #include <malloc.h>
+#endif
 #include <string.h>
 #include <math.h>
 
@@ -187,8 +189,13 @@ void set_2d_array(real_t arr[LEN_2D][LEN_2D], real_t value, int stride)
 }
 
 void init(int** ip, real_t* s1, real_t* s2){
+#ifndef __APPLE__
     xx = (real_t*) memalign(ARRAY_ALIGNMENT, LEN_1D*sizeof(real_t));
     *ip = (int *) memalign(ARRAY_ALIGNMENT, 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    
 
     for (int i = 0; i < LEN_1D; i = i+5){
         (*ip)[i]   = (i+4);


                 reply	other threads:[~2021-11-05 21:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211105210706.76155385840A@sourceware.org \
    --to=iains@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).