From 71336e837a51986aa12ca7e27e6ae0549d509aec Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 18 May 2026 22:47:37 -0700 Subject: [PATCH] Pacify GCC 16.1.1 -Wanalyzer-null-dereference * src/regex-emacs.c (forall_firstchar): Avoid undefined behavior in the 2nd eassert when !bufp && !pend. This pacifies GCC 16.1.1 20260501 (Red Hat 16.1.1-1) x86-64 when Emacs is configured with --enable-gcc-warnings. --- src/regex-emacs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/regex-emacs.c b/src/regex-emacs.c index 7c8ee144257..03c4ba3e4e9 100644 --- a/src/regex-emacs.c +++ b/src/regex-emacs.c @@ -3044,8 +3044,7 @@ static bool forall_firstchar (struct re_pattern_buffer *bufp, re_char *p, re_char *pend, bool f (re_char *p, void *arg), void *arg) { - eassert (!bufp || bufp->used); - eassert (pend || bufp->used); + eassert (bufp ? !!bufp->used : !!pend); return forall_firstchar_1 (p, pend, bufp ? bufp->buffer - 1 : p, bufp ? bufp->buffer + bufp->used + 1 : pend,