__vector(ubyte[32]) misalignment

user1234 user123 at 12.de
Sun Aug 9 05:49:23 UTC 2020


On Sunday, 9 August 2020 at 01:56:54 UTC, Bruce Carneal wrote:
> On Sunday, 9 August 2020 at 01:03:51 UTC, Bruce Carneal wrote:
>> The .alignof attribute of __vector(ubyte[32]) is 32 but 
>> initializing an array of such vectors via an assignment to 
>> .length has given me 16 byte alignment (and subsequent seg 
>> faults which I suspect are related).
>>
>> Is sub .alignof alignment expected here?  IOW, do I have to 
>> manually manage memory if I want alignments above 16?
>
> Manually managing the alignment eliminated the seg faulting.
>
> Additionally, I found that std.experimental.mallocator 
> Mallocator.alignment is 16.
>
> So, is the misalignment baked in at this point?

there's AlignedMallocator that allows to overrides the 
"platformAlignment".
To get vector spece Mallocator is indeed a bad choice.


More information about the Digitalmars-d-learn mailing list