r263367 - in /branches/gcc-8-branch/libstdc++-v...

redi@gcc.gnu.org redi@gcc.gnu.org
Tue Aug 7 21:38:00 GMT 2018

Author: redi
Date: Tue Aug  7 21:38:45 2018
New Revision: 263367

URL: https://gcc.gnu.org/viewcvs?rev=263367&root=gcc&view=rev
PR libstdc++/86861 Meet precondition for Solaris memalign

Solaris memalign requires alignment to be at least sizeof(int), so
increase it as needed.

Also move the check for valid alignments from the fallback
implementation of aligned_alloc into operator new, as it's required for
all of aligned_alloc, memalign, posix_memalign and __aligned_malloc.

Backport from mainline
2018-08-07  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/86861
	* libsupc++/new_opa.cc [_GLIBCXX_HAVE_MEMALIGN] (aligned_alloc):
	Replace macro with inline function.
	[__sun]: Increase alignment to meet memalign precondition.
	(aligned_alloc): Move check for valid alignment to operator new.
	Remove redundant check for non-zero size, it's enforced by the caller.
	(operator new): Move check for valid alignment here. Use
	__builtin_expect on check for zero size.


More information about the Libstdc++-cvs mailing list