public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] PR libstdc++/92143 adjust for OS X aligned_alloc behaviour
@ 2019-10-18 11:27 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2019-10-18 11:27 UTC (permalink / raw)
  To: libstdc++, gcc-patches

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

OS X 10.15 adds aligned_alloc but it has the same restriction as the AIX
version, namely that alignments smaller than sizeof(void*) are not
supported.

	PR libstdc++/92143
	* libsupc++/new_opa.cc (operator new) [__APPLE__]: Increase alignment
	to at least sizeof(void*).

Tested powerpc64le-linux, committed to trunk.


[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1198 bytes --]

commit 356a59f69de9896d5b517cb28790da4335fd758f
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Oct 18 11:45:20 2019 +0100

    PR libstdc++/92143 adjust for OS X aligned_alloc behaviour
    
    OS X 10.15 adds aligned_alloc but it has the same restriction as the AIX
    version, namely that alignments smaller than sizeof(void*) are not
    supported.
    
            PR libstdc++/92143
            * libsupc++/new_opa.cc (operator new) [__APPLE__]: Increase alignment
            to at least sizeof(void*).

diff --git a/libstdc++-v3/libsupc++/new_opa.cc b/libstdc++-v3/libsupc++/new_opa.cc
index aa5d2e14455..80eb343a1c8 100644
--- a/libstdc++-v3/libsupc++/new_opa.cc
+++ b/libstdc++-v3/libsupc++/new_opa.cc
@@ -108,9 +108,10 @@ operator new (std::size_t sz, std::align_val_t al)
     sz = 1;
 
 #if _GLIBCXX_HAVE_ALIGNED_ALLOC
-# ifdef _AIX
+# if defined _AIX || defined __APPLE__
   /* AIX 7.2.0.0 aligned_alloc incorrectly has posix_memalign's requirement
-   * that alignment is a multiple of sizeof(void*).  */
+   * that alignment is a multiple of sizeof(void*).
+   * OS X 10.15 has the same requirement.  */
   if (align < sizeof(void*))
     align = sizeof(void*);
 # endif

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-10-18 11:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-18 11:27 [PATCH] PR libstdc++/92143 adjust for OS X aligned_alloc behaviour Jonathan Wakely

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