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.
This commit is contained in:
Paul Eggert 2026-05-18 22:47:37 -07:00
parent 07fe0b297b
commit 71336e837a

View file

@ -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,