[cfe-dev] Is this an over alignment bug for ARM?

Zhao, Weiming via cfe-dev cfe-dev at lists.llvm.org
Thu Feb 18 18:10:34 PST 2016


I see. I will keep digging why malloc is retuning a 4-byte aligned address.

Thanks a lot for the info!

Weiming


On 2/18/2016 5:29 PM, Tim Northover wrote:
> On 18 February 2016 at 16:32, Zhao, Weiming <weimingz at codeaurora.org> wrote:
>> Thanks for the answer.
>> So "new" or malloc should guarantee that it returns  a at-least 8-byte aligned "this" pointer, is that correct?
> Probably. They need to return something compatible with max_align_t,
> which I strongly suspect is 8-byte aligned on Android.
>
> There is a concept of "extended alignment" in the C and C++ standards,
> where the user may have to realign the results of malloc manually, or
> presumably implement custom new operators. This mostly only applies to
> things like AVX-512 vectors though.
>
> Cheers.
>
> Tim.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation




More information about the cfe-dev mailing list