summaryrefslogtreecommitdiff
path: root/src/port
diff options
context:
space:
mode:
authorTom Lane2021-02-13 22:49:08 +0000
committerTom Lane2021-02-13 22:49:08 +0000
commit22001684623bd95b4e1d5c21854f222a37b13267 (patch)
tree3411243799fd1a12cbbb52a8cc510672e88e0cb8 /src/port
parenta28df6fa3041523f9a96cf0d3c3929f8bdc7c797 (diff)
pg_attribute_no_sanitize_alignment() macro
Modern gcc and clang compilers offer alignment sanitizers, which help to detect pointer misalignment. However, our codebase already contains x86-specific crc32 computation code, which uses unalignment access. Thankfully, those compilers also support the attribute, which disables alignment sanitizers at the function level. This commit adds pg_attribute_no_sanitize_alignment(), which wraps this attribute, and applies it to pg_comp_crc32c_sse42() function. Back-patch of commits 993bdb9f9 and ad2ad698a, to enable doing alignment testing in all supported branches. Discussion: https://postgr.es/m/CAPpHfdsne3%3DT%3DfMNU45PtxdhSL_J2PjLTeS8rwKnJzUR4YNd4w%40mail.gmail.com Discussion: https://postgr.es/m/475514.1612745257%40sss.pgh.pa.us Author: Alexander Korotkov, revised by Tom Lane Reviewed-by: Tom Lane
Diffstat (limited to 'src/port')
-rw-r--r--src/port/pg_crc32c_sse42.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/port/pg_crc32c_sse42.c b/src/port/pg_crc32c_sse42.c
index b9def7e2ea5..fb2b54fa463 100644
--- a/src/port/pg_crc32c_sse42.c
+++ b/src/port/pg_crc32c_sse42.c
@@ -18,6 +18,7 @@
#include <nmmintrin.h>
+pg_attribute_no_sanitize_alignment()
pg_crc32c
pg_comp_crc32c_sse42(pg_crc32c crc, const void *data, size_t len)
{