Re: Detecting pointer misalignment (was Re: pgsql: Implementation of subscripting for jsonb)
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexander Korotkov <aekorotkov@gmail.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>,
Alexander Korotkov <akorotkov@postgresql.org>,
pgsql-hackers@lists.postgresql.org
Date: 2021-02-08T01:20:00Z
Lists: pgsql-hackers
I wrote: > * Both clang and gcc seem to be happy with the same spelling of the > function attribute, which is fortunate. However, I seriously doubt > that bare "#ifdef __GNUC__" is going to be good enough. At the very > least there's going to need to be a compiler version test in there, > and we might end up needing to get the configure script involved. After digging in gcc's release history, it seems they invented "-fsanitize=alignment" in GCC 5, so we can make this work for gcc by writing #if __GNUC__ >= 5 (the likely() macro already uses a similar approach). Can't say if that's close enough for clang too. regards, tom lane
Commits
-
pg_attribute_no_sanitize_alignment() macro
- cc7ea0717b12 9.6.22 landed
- c86eae39ce1e 13.3 landed
- c3dc311ffd64 12.7 landed
- 22001684623b 11.12 landed
- 02e7da01a436 10.17 landed
- 993bdb9f935a 14.0 landed
-
Tweak compiler version cutoff for no_sanitize("alignment") support.
- ad2ad698ac16 14.0 landed
-
Implementation of subscripting for jsonb
- 676887a3b0b8 14.0 cited