Andres Freund <andres@anarazel.de> writes:
> On 2018-04-07 14:07:05 -0400, Tom Lane wrote:
>> TRAP: UnalignedPointer("(((uintptr_t) ((uintptr_t)(ptr)) + ((sizeof(*ptr)) - 1)) & ~((uintptr_t) ((sizeof(*ptr)) -
1)))!= (uintptr_t)(ptr)", File: "../../../src/include/port/atomics.h", Line: 177)
> Yea, I just saw that.
> Afaict it's "just" an over-eager / wrong assert. I can't for the heck of
> it think why I wrote (9.5 timeframe)
> AssertPointerAlignment(ptr, sizeof(*ptr));
> where the bigger ones all have asserts alignment to their own size. I
> assume I did because some platforms want to do atomics bigger than a
> single int - but then I should've used sizeof(ptr->value). So far
> pademelon is the only animal affected afaict - let me think about it for
> a bit and come up with a patch, ok?
I think I'd just drop those asserts altogether. The hardware is in charge
of complaining about misaligned pointers.
If you do insist on asserting something, it needs to be about ptr->sema;
the bool value field isn't going to have any interesting alignment
requirement, but the sema might.
regards, tom lane