Re: [HACKERS] Fix misaligned access of ItemPointerData on ARM

2015-05-21 Thread Tom Lane
Andres Freund writes: > On 2015-05-21 16:49:27 -0400, Tom Lane wrote: >> I considered also adding a Static_assert about sizeof(ItemIdData), >> but I'm afraid that compilers that don't support these pragmas >> probably don't support Static_assert either, so it's not clear >> that that would catch a

Re: [HACKERS] Fix misaligned access of ItemPointerData on ARM

2015-05-21 Thread Tom Lane
Piotr Stefaniak writes: > On 05/21/2015 10:08 PM, Tom Lane wrote: >> It's not clear to me whether all compilers that accept "packed" also >> accept "aligned", but there are enough ARM machines in the buildfarm >> that we could hope that we'll find out if this isn't portable. > I think src/include

Re: [HACKERS] Fix misaligned access of ItemPointerData on ARM

2015-05-21 Thread Andres Freund
On 2015-05-21 16:49:27 -0400, Tom Lane wrote: > I considered also adding a Static_assert about sizeof(ItemIdData), > but I'm afraid that compilers that don't support these pragmas > probably don't support Static_assert either, so it's not clear > that that would catch anything. I think your fallba

Re: [HACKERS] Fix misaligned access of ItemPointerData on ARM

2015-05-21 Thread Tom Lane
Andrew Dunstan writes: > On 05/21/2015 04:08 PM, Tom Lane wrote: >> I wonder whether we should drop the ARM assumption and instead write >> >> #if defined(pg_attribute_packed) && defined(pg_attribute_aligned) >> pg_attribute_packed() >> pg_attribute_aligned(2) >> #endif >> >> so that the annotat

Re: [HACKERS] Fix misaligned access of ItemPointerData on ARM

2015-05-21 Thread Andrew Dunstan
On 05/21/2015 04:08 PM, Tom Lane wrote: I wrote: But BlockIdData is laid out and accessed as two 16-bit fields, so there should be no problem. On what platform exactly do you see a failure? Ah, after reading the gcc manual a bit more closely, I get the point. For some reason I think we assume

Re: [HACKERS] Fix misaligned access of ItemPointerData on ARM

2015-05-21 Thread Tom Lane
I wrote: > But BlockIdData is laid out and accessed as two 16-bit fields, so there > should be no problem. On what platform exactly do you see a failure? Ah, after reading the gcc manual a bit more closely, I get the point. For some reason I think we assumed that "packed" would not result in misa

Re: [HACKERS] Fix misaligned access of ItemPointerData on ARM

2015-05-21 Thread Andres Freund
On 2015-05-21 15:34:00 -0400, Tom Lane wrote: > Piotr Stefaniak writes: > > But due to how ExecRowMark struct is laid out in memory, the packed > > struct ItemPointerData begins at an uneven offset, leading to misaligned > > access whenever BlockIdData is set by ItemPointerSetInvalid() (and > >

Re: [HACKERS] Fix misaligned access of ItemPointerData on ARM

2015-05-21 Thread Tom Lane
Piotr Stefaniak writes: > But due to how ExecRowMark struct is laid out in memory, the packed > struct ItemPointerData begins at an uneven offset, leading to misaligned > access whenever BlockIdData is set by ItemPointerSetInvalid() (and > likely in some other places, too). But BlockIdData is