[PATCH] D12247: [libc++] remove possible trailing padding from aligned_storage

Xinliang David Li via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 26 16:25:12 PDT 2015


On Wed, Aug 26, 2015 at 3:38 PM, Eric Fiselier <eric at efcs.ca> wrote:
> EricWF added a comment.
>
> In http://reviews.llvm.org/D12247#233717, @yiranwang wrote:
>
>> Hi Eric,
>>
>> Could you please explain a bit more what is broken specifically? As we can see, sizeof(), _Len, and _Align, and alignof() of "aligned_storage" are all not changed.
>
>
> That's correct. At the risk of sounding like a broken record those fields have not changed because doing so would break the ABI. Instead my patch fixes the issue your seeing by simply not using __buf_ unless its the correct size and correctly aligned.

This seems safe. The downside is that some cases which uses internal
buffer before now will use dynamic allocator which might have some
small performance and memory regression.

David

>
> The alignment is the important part. Previously we didn't check if `Fn` was alignment compatible with `__buf_`.
>
>
> http://reviews.llvm.org/D12247
>
>
>


More information about the cfe-commits mailing list