This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR libstdc++/77691 increase allocation size to at least alignment


It's not safe to assume that malloc(n) returns memory aligned to more
than n, so when relying on the guaranteed alignment of malloc ensure
that the number of bytes allocated is at least as large as the
alignment.

	PR libstdc++/77691
	* include/experimental/memory_resource (__resource_adaptor_imp): Do
	not allocate sizes smaller than alignment when relying on guaranteed
	alignment.
	* testsuite/experimental/memory_resource/new_delete_resource.cc:
	Adjust expected number of bytes allocated for alignof(max_align_t).

Tested x86_64-linux, committed to trunk.

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]