From 4fb8f706ce9feaeee4c5a046ba5dbb62ff2ccbe7 Mon Sep 17 00:00:00 2001 From: Johannes Demel Date: Sun, 26 Sep 2021 16:56:41 +0200 Subject: [PATCH] index: Fix volk_get_index This function results in an infinite loop on Debian 11 for some impls. This is a first step to fix it. Fix #516 Signed-off-by: Johannes Demel --- lib/volk_rank_archs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/volk_rank_archs.c b/lib/volk_rank_archs.c index 7cf3fd713..0a79d278c 100644 --- a/lib/volk_rank_archs.c +++ b/lib/volk_rank_archs.c @@ -34,13 +34,16 @@ int volk_get_index(const char* impl_names[], // list of implementations by name { unsigned int i; for (i = 0; i < n_impls; i++) { - if (!strncmp(impl_names[i], impl_name, 20)) { + if (!strncmp(impl_names[i], impl_name, 42)) { return i; } } // TODO return -1; // something terrible should happen here fprintf(stderr, "Volk warning: no arch found, returning generic impl\n"); + if (strncmp(impl_name, "generic", 20)) { + return -1; + } return volk_get_index(impl_names, n_impls, "generic"); // but we'll fake it for now }