Skip to content

Commit 187ecda

Browse files
committed
[#28519] build: Fix GCC 12 build
Summary: This fixes two compile errors in GCC 12 build: 1. Error from `#pragma GCC diagnostic ignored "-Wshorten-64-to-32"` which GCC does not support. This pragma was changed to only be used with Clang. 2. Error from avx512fintrin.h emitting: ``` In file included from /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/include/immintrin.h:49, from /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/include/x86intrin.h:32, from ../../src/inline-thirdparty/hnswlib/hnswlib/hnswlib.h:34, from ../../src/yb/ann_methods/hnswlib_wrapper.cc:32: In function '__m256d _mm512_extractf64x4_pd(__m512d, int)', inlined from 'double _mm512_reduce_add_pd(__m512d)' at /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/include/avx512fintrin.h:16399:3, inlined from 'void simsimd_dot_f64_skylake(const simsimd_f64_t*, const simsimd_f64_t*, simsimd_size_t, simsimd_distance_t*)' at ../../src/inline-thirdparty/simsimd/simsimd/dot.h:1253:35: /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/include/avx512fintrin.h:5946:10: error: '__Y' is used uninitialized [-Werror=uninitialized] 5946 | return (__m256d) __builtin_ia32_extractf64x4_mask ((__v8df) __A, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5947 | __imm, | ~~~~~~ 5948 | (__v4df) | ~~~~~~~~ 5949 | _mm256_undefined_pd (), | ~~~~~~~~~~~~~~~~~~~~~~~ 5950 | (__mmask8) -1); | ~~~~~~~~~~~~~~ ``` This is due to a GCC issue (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105593) that affects GCC 12 versions under 12.3.0. Added `-Wno-self-init` to suppress the warning for 12.x (x < 3). Jira: DB-18208 Test Plan: Jenkins: compile only Jenkins run on D46343 with GCC 12 (12.2.1). Also built locally with GCC 12.3.0. Reviewers: sergei Reviewed By: sergei Subscribers: yql, ybase Tags: #jenkins-ready Differential Revision: https://phorge.dev.yugabyte.com/D46562
1 parent 7886fda commit 187ecda

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,11 @@ if(IS_GCC)
426426
# https://gist.githubusercontent.com/mbautin/de18543ea85d46db49dfa4b4b7df082a/raw
427427
ADD_CXX_FLAGS("-Wno-use-after-free")
428428
endif()
429+
if ("${COMPILER_VERSION}" MATCHES "^12[.][012].*$")
430+
# GCC 12 before 12.3 raises a warning due to __m256d __Y = __Y; from avxintrin.h
431+
# (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105593).
432+
ADD_CXX_FLAGS("-Wno-init-self")
433+
endif()
429434

430435
# This normally gets disabled automatically (with a warning) for some files due to size of code.
431436
# Disable it explicitly to avoid the warning about it getting disabled automatically.

src/yb/vector_index/usearch_include_wrapper_internal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@
5656
#define USEARCH_USE_SIMSIMD 1
5757

5858
#if defined(__x86_64__) || defined(_M_X64)
59+
#if defined(__clang__)
5960
#pragma GCC diagnostic ignored "-Wshorten-64-to-32"
61+
#endif
6062

6163
#define SIMSIMD_TARGET_HASWELL 1
6264
#define SIMSIMD_TARGET_SKYLAKE 1

0 commit comments

Comments
 (0)