From b48905892de36bada2929e2992b88f6aff7d9dd0 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 1 Aug 2021 12:26:49 -0700 Subject: [PATCH] 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. --- ChangeLog | 6 ++++++ lib/regex_internal.c | 4 ++++ 2 files changed, 10 insertions(+) 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; -- 2.39.5