From: Jim Meyering Date: Sun, 1 Aug 2021 19:26:49 +0000 (-0700) Subject: regex: pacify GCC 11.2.1's -fanalyzer X-Git-Tag: v1.0~2760 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=b48905892de36bada2929e2992b88f6aff7d9dd0;p=gnulib.git regex: pacify GCC 11.2.1's -fanalyzer * lib/regex_internal.c (re_node_set_merge): Add a debug assertion to pacify GCC 11.2.1's -fanalyzer. --- diff --git a/ChangeLog b/ChangeLog index dbd0598ec5..21fbc52e30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2021-08-01 Jim Meyering + + regex: pacify GCC 11.2.1's -fanalyzer + * lib/regex_internal.c (re_node_set_merge): + Add a debug assertion to pacify GCC 11.2.1's -fanalyzer. + 2021-08-01 Bruno Haible limits-h tests: Add tests for BOOL_MAX and BOOL_WIDTH. diff --git a/lib/regex_internal.c b/lib/regex_internal.c index 6f755b214f..aefcfa2f52 100644 --- a/lib/regex_internal.c +++ b/lib/regex_internal.c @@ -1211,6 +1211,10 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src) if (__glibc_unlikely (dest->nelem == 0)) { + /* Although we already guaranteed above that dest->alloc != 0 and + therefore dest->elems != NULL, add a debug assertion to pacify + GCC 11.2.1's -fanalyzer. */ + DEBUG_ASSERT (dest->elems); dest->nelem = src->nelem; memcpy (dest->elems, src->elems, src->nelem * sizeof (Idx)); return REG_NOERROR;