v2-crc-workaround-clang-18.patch

application/x-patch

Filename: v2-crc-workaround-clang-18.patch
Type: application/x-patch
Part: 0
Message: Re: Invalid control file checksum with AVX-512 during initdb on a clang19 -O0 build

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
Series: patch v2
File+
src/port/pg_crc32c_sse42_choose.c 3 1
diff --git a/src/port/pg_crc32c_sse42_choose.c b/src/port/pg_crc32c_sse42_choose.c
index 74d2421ba2b..802e47788c1 100644
--- a/src/port/pg_crc32c_sse42_choose.c
+++ b/src/port/pg_crc32c_sse42_choose.c
@@ -95,7 +95,9 @@ pg_comp_crc32c_choose(pg_crc32c crc, const void *data, size_t len)
 			__cpuidex(exx, 7, 0);
 #endif
 
-#ifdef USE_AVX512_CRC32C_WITH_RUNTIME_CHECK
+#if defined(__clang__) && !defined(__OPTIMIZE__)
+			/* Some versions of clang are broken at -O0 */
+#elif defined(USE_AVX512_CRC32C_WITH_RUNTIME_CHECK)
 			if (exx[2] & (1 << 10) &&	/* VPCLMULQDQ */
 				exx[1] & (1 << 31)) /* AVX512-VL */
 				pg_comp_crc32c = pg_comp_crc32c_avx512;