public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, testsuite]: Use posix_memalign instead of aligned_alloc in gcc.dg/strncmp-2.c
@ 2017-02-17  9:56 Uros Bizjak
  2017-02-21  4:43 ` Aaron Sawdey
  0 siblings, 1 reply; 2+ messages in thread
From: Uros Bizjak @ 2017-02-17  9:56 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 266 bytes --]

posix_memalign is portable to older, non-c11 runtimes.

2017-02-17  Uros Bizjak  <ubizjak@gmail.com>

    * gcc.dg/strncmp-2.c (test_driver_strncmp): Use posix_memalign
    instead of aligned_alloc.

Tested on x86_64-linux-gnu, CentOS 5.11.

OK for mainline?

Uros.

[-- Attachment #2: t.diff.txt --]
[-- Type: text/plain, Size: 588 bytes --]

diff --git a/gcc/testsuite/gcc.dg/strncmp-2.c b/gcc/testsuite/gcc.dg/strncmp-2.c
index 0c9a07a..8d799a1 100644
--- a/gcc/testsuite/gcc.dg/strncmp-2.c
+++ b/gcc/testsuite/gcc.dg/strncmp-2.c
@@ -19,10 +19,13 @@ 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;
   char *p2;
   int r,i,e;
 
+  r = posix_memalign ((void **)&buf2,pgsz,2*pgsz);
+  if (r < 0) abort ();
+
   r = mprotect (buf2+pgsz,pgsz,PROT_NONE);
   if (r < 0) abort();
   

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH, testsuite]: Use posix_memalign instead of aligned_alloc in gcc.dg/strncmp-2.c
  2017-02-17  9:56 [PATCH, testsuite]: Use posix_memalign instead of aligned_alloc in gcc.dg/strncmp-2.c Uros Bizjak
@ 2017-02-21  4:43 ` Aaron Sawdey
  0 siblings, 0 replies; 2+ messages in thread
From: Aaron Sawdey @ 2017-02-21  4:43 UTC (permalink / raw)
  To: Uros Bizjak, gcc-patches; +Cc: Segher Boessenkool

On Fri, 2017-02-17 at 10:50 +0100, Uros Bizjak wrote:
> posix_memalign is portable to older, non-c11 runtimes.
> 
> 2017-02-17  Uros Bizjak  <ubizjak@gmail.com>
> 
>     * gcc.dg/strncmp-2.c (test_driver_strncmp): Use posix_memalign
>     instead of aligned_alloc.
> 
> Tested on x86_64-linux-gnu, CentOS 5.11.
> 
> OK for mainline?

Uros,
  I posted something very similar last Tuesday:

https://gcc.gnu.org/ml/gcc-patches/2017-02/msg00937.html

I didn't get around to applying it until this morning in 245608.
Apologies for wasting your time tracking down the same issue again.

  Aaron

-- 
Aaron Sawdey, Ph.D.  acsawdey@linux.vnet.ibm.com
050-2/C113  (507) 253-7520 home: 507/263-0782
IBM Linux Technology Center - PPC Toolchain

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-21  1:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-17  9:56 [PATCH, testsuite]: Use posix_memalign instead of aligned_alloc in gcc.dg/strncmp-2.c Uros Bizjak
2017-02-21  4:43 ` Aaron Sawdey

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).