On Mon, Feb 27, 2017 at 03:08:35PM +1300, Thomas Munro wrote: > On Mon, Feb 27, 2017 at 2:18 PM, Noah Misch <n...@leadboat.com> wrote: > > I wondered the same thing; if nothing else, why don't protosciurus and > > castoroides fail the same way? They do use older compilers, "Sun C 5.10 > > SunOS_sparc 2009/06/03" and gcc 3.4.3. I have "Sun C 5.12 SunOS_sparc > > 2011/11/16" and gcc 4.9.2, both of which are alignment-sensitive in several > > configurations, according to the attached test program. However, in a > > 32-bit > > build with this Sun C, I don't get alignment-related bus errors. (Those > > animals build 64-bit, so this isn't the full story.) > > It's been a while but I seem to recall that Sun C defaulted to a > -xmemalign setting that tolerated misaligned reads in 32 bit builds, > but used a different default on 64 bit builds. "Solaris Application > Programming" 5.8.5 seems to confirm this: "For 32-bit applications, > since Sun Studio 9, the default is for the compiler to assume 8-byte > alignment and to trap and correct any misaligned data accesses. For > 64-bit applications, the compiler assumes 8-byte alignment, but the > application will SIGBUS on a misaligned access." > > Yet castoroides seems to be building with -m64, so that's not the > explanation. Could it be correctly aligned by coincidence?
Coincidental alignment was it. ps_snapshot_data has offset 16 in a 64-bit build and offset 12 in a 32-bit build, so it is well-aligned in 64-bit only. I was building a 32-bit PostgreSQL; when I build a 64-bit PostgreSQL, I no longer get the SIGBUS. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers