From ead3ff5ea4a50064b89751981bb02d9cb448da02 Mon Sep 17 00:00:00 2001 From: Egor Ignatov Date: Mon, 21 Sep 2026 13:04:19 +0500 Subject: [PATCH] Fix crash on 32-bit x86 CPUs that support AVX-512 The AVX-512 implementations in simd-string-512.c are built only for x86-64, on other platforms they are stubs that call fatal(). However, init_simd() enables them whenever the CPU reports AVX-512 support, which it also does when running a 32-bit x86 build. That build then exits as soon as it decodes any UTF-8 or draws any text. Never select the AVX-512 implementations on platforms for which they are not built, whether detected at runtime or requested via KITTY_SIMD=512. --- kitty/simd-string.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kitty/simd-string.c b/kitty/simd-string.c index 0e1a3a46b..7d28b7056 100644 --- a/kitty/simd-string.c +++ b/kitty/simd-string.c @@ -388,6 +388,10 @@ init_simd(void *x) { has_avx2 = strcmp(simd_env, "256") == 0; has_avx512 = strcmp(simd_env, "512") == 0; } +#if !(defined(__x86_64__) || defined(__amd64__)) || defined(KITTY_NO_SIMD) + // The AVX-512 implementations are x86-64 only, elsewhere they are stubs that call fatal() + has_avx512 = false; +#endif #undef do_check if (has_avx512) {