aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2019-10-18 12:27:31 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2019-10-18 12:27:31 +0100
commit15abd9320d4492f58783ac31b9fa651cec7747f3 (patch)
treea949dae0d0bd8418f3db2ec2d3e48605fcf68c80
parent7e4b7d7bacd750628a99a42237e75810a4359b74 (diff)
downloadgcc-15abd9320d4492f58783ac31b9fa651cec7747f3.zip
gcc-15abd9320d4492f58783ac31b9fa651cec7747f3.tar.gz
gcc-15abd9320d4492f58783ac31b9fa651cec7747f3.tar.bz2
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*). From-SVN: r277151
-rw-r--r--libstdc++-v3/ChangeLog4
-rw-r--r--libstdc++-v3/libsupc++/new_opa.cc5
2 files changed, 7 insertions, 2 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index c37bbd0..8f39e66 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,9 @@
2019-10-18 Jonathan Wakely <jwakely@redhat.com>
+ PR libstdc++/92143
+ * libsupc++/new_opa.cc (operator new) [__APPLE__]: Increase alignment
+ to at least sizeof(void*).
+
* include/bits/range_cmp.h (ranges::less::operator()): Inline the
logic from std::less::operator() to remove the dependency on it.
diff --git a/libstdc++-v3/libsupc++/new_opa.cc b/libstdc++-v3/libsupc++/new_opa.cc
index aa5d2e14..80eb343 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