libstdc++: Extend max_align_t special case to 64-bit HP-UX [PR77691]
GCC's std::max_align_t doesn't agree with the system malloc on HP-UX, so generalize the current hack for Solaris to apply to that target too. libstdc++-v3/ChangeLog: PR libstdc++/77691 * include/experimental/memory_resource (_GLIBCXX_MAX_ALIGN_MATCHES_MALLOC): Define. (do_allocate, do_deallocate): Check it. * testsuite/experimental/memory_resource/new_delete_resource.cc: Relax expected behaviour for 64-bit hppa-hp-hpux11.11.
This commit is contained in:
parent
ac1c7fcce1
commit
f629f63d2d
2 changed files with 16 additions and 3 deletions
|
@ -412,11 +412,20 @@ namespace pmr {
|
|||
allocator_type get_allocator() const noexcept { return _M_alloc; }
|
||||
|
||||
protected:
|
||||
#if (defined __sun__ || defined __VXWORKS__) && defined __i386__
|
||||
// Cannot use max_align_t on 32-bit Solaris x86, see PR libstdc++/77691
|
||||
# define _GLIBCXX_MAX_ALIGN_MATCHES_MALLOC 0
|
||||
#elif defined __hpux__ && defined __hppa__ && defined __LP64__
|
||||
// Ignore inconsistent long double and malloc alignment (libstdc++/77691)
|
||||
# define _GLIBCXX_MAX_ALIGN_MATCHES_MALLOC 0
|
||||
#else
|
||||
# define _GLIBCXX_MAX_ALIGN_MATCHES_MALLOC 1
|
||||
#endif
|
||||
|
||||
virtual void*
|
||||
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 __VXWORKS__) && defined __i386__)
|
||||
#if _GLIBCXX_MAX_ALIGN_MATCHES_MALLOC
|
||||
if (__alignment == alignof(max_align_t))
|
||||
return _M_allocate<alignof(max_align_t)>(__bytes);
|
||||
#endif
|
||||
|
@ -442,7 +451,7 @@ namespace pmr {
|
|||
do_deallocate(void* __ptr, size_t __bytes, size_t __alignment) noexcept
|
||||
override
|
||||
{
|
||||
#if ! ((defined __sun__ || defined __VXWORKS__) && defined __i386__)
|
||||
#if _GLIBCXX_MAX_ALIGN_MATCHES_MALLOC
|
||||
if (__alignment == alignof(max_align_t))
|
||||
return (void) _M_deallocate<alignof(max_align_t)>(__ptr, __bytes);
|
||||
#endif
|
||||
|
|
|
@ -27,6 +27,10 @@
|
|||
// See PR libstdc++/77691
|
||||
# define BAD_MAX_ALIGN_T 1
|
||||
#endif
|
||||
#if defined __hpux__ && defined __hppa__ && defined __LP64__
|
||||
// Ignore inconsistent long double and malloc alignment (libstdc++/77691)
|
||||
# define BAD_MAX_ALIGN_T 1
|
||||
#endif
|
||||
|
||||
bool new_called = false;
|
||||
bool delete_called = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue