https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77691

--- Comment #39 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to dave.anglin from comment #37)
> I believe I changed the glibc value because of the pthread mutex issue.

Aha.

> MALLOC_ABI_ALIGNMENT is defined in pa32-linux.h as follows:
> #define MALLOC_ABI_ALIGNMENT 128
> 
> So, the defines are now consistent on linux.  The only remaining problem is
> 64-bit hpux where the actual
> malloc alignment is 8 bytes.  The resource_adapter.cc test still fails on

I've just committed a change to the resource_adaptor implementation, but I
don't expect it to change the FAIL for hpux yet. I hope the FAILs are fixed for
Solaris now though, and if so then we make the special case apply to 64-bit
hpux too, like so (are these the right macros to check for?):

diff --git a/libstdc++-v3/include/experimental/memory_resource
b/libstdc++-v3/include/experimental/memory_resource
index dde3753fab7..dd6f3099a78 100644
--- a/libstdc++-v3/include/experimental/memory_resource
+++ b/libstdc++-v3/include/experimental/memory_resource
@@ -413,7 +413,8 @@ namespace pmr {
       do_allocate(size_t __bytes, size_t __alignment) override
       {
        // Cannot use max_align_t on 32-bit Solaris x86, see PR libstdc++/77691
-#if ! (defined __sun__ && defined __i386__)
+#if ! (defined __sun__ && defined __i386__) \
+       && ! (defined __hpux && defined _LP64)
        if (__alignment == alignof(max_align_t))
          return _M_allocate<alignof(max_align_t)>(__bytes);
 #endif
@@ -439,7 +440,8 @@ namespace pmr {
       do_deallocate(void* __ptr, size_t __bytes, size_t __alignment) noexcept
       override
       {
-#if ! (defined __sun__ && defined __i386__)
+#if ! (defined __sun__ && defined __i386__) \
+       && ! (defined __hpux && defined _LP64)
        if (__alignment == alignof(max_align_t))
          return (void) _M_deallocate<alignof(max_align_t)>(__ptr, __bytes);
 #endif
diff --git
a/libstdc++-v3/testsuite/experimental/memory_resource/new_delete_resource.cc
b/libstdc++-v3/testsuite/experimental/memory_resource/new_delete_resource.cc
index 7dcb408f3f7..d4353ff6464 100644
---
a/libstdc++-v3/testsuite/experimental/memory_resource/new_delete_resource.cc
+++
b/libstdc++-v3/testsuite/experimental/memory_resource/new_delete_resource.cc
@@ -23,7 +23,8 @@
 #include <cstdlib>
 #include <testsuite_hooks.h>

-#if defined __sun__ && defined __i386__
+#if (defined __sun__ && defined __i386__) \
+       || (defined __hpux && defined _LP64)
 // See PR libstdc++/77691
 # define BAD_MAX_ALIGN_T 1
 #endif




> it.  Maybe I should change BIGGEST_ALIGNMENT
> and MALLOC_ABI_ALIGNMENT to match the malloc implementation?

I think that makes sense (although it won't change anything until we make the
suggestion from PR 90569 as well, so I'll do that this week).

Reply via email to