Tim Rühsen wrote: > configure:36833: checking whether memmem works > SUMMARY: UndefinedBehaviorSanitizer: invalid-null-argument
This patch should fix it. 2020-05-21 Bruno Haible <br...@clisp.org> memmem: Avoid wrong configure results with "clang -fsanitize=undefined". Reported by Tim Rühsen in <https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00207.html>. * m4/memmem.m4 (gl_FUNC_MEMMEM_SIMPLE): Use NULL + 1, not NULL. diff --git a/m4/memmem.m4 b/m4/memmem.m4 index e034d7b..35a5bb1 100644 --- a/m4/memmem.m4 +++ b/m4/memmem.m4 @@ -1,4 +1,4 @@ -# memmem.m4 serial 26 +# memmem.m4 serial 27 dnl Copyright (C) 2002-2004, 2007-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -37,7 +37,7 @@ AC_DEFUN([gl_FUNC_MEMMEM_SIMPLE], /* Check for empty needle behavior. */ { const char *haystack = "AAA"; - if (memmem (haystack, 3, NULL, 0) != haystack) + if (memmem (haystack, 3, (const char *) 1, 0) != haystack) result |= 2; } return result;