From 53701517c6517e5161e4533e44c33b5e4db17314 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 31 Jul 2021 13:32:02 -0700 Subject: [PATCH] regex: pacify GCC 11.2 -fanalyzer * lib/regex_internal.c (re_node_set_insert): Add a debug assertion to pacify GCC 11.2 -fanalyzer. --- ChangeLog | 4 ++++ lib/regex_internal.c | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 80bcabd227..e3b868f91b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2021-07-31 Paul Eggert + regex: pacify GCC 11.2 -fanalyzer + * lib/regex_internal.c (re_node_set_insert): + Add a debug assertion to pacify GCC 11.2 -fanalyzer. + maint: pacify GCC 11.2 -fanalyzer in crypto tests * tests/bench-digest.h (main): Report an error after memory exhaustion, instead of using a null pointer. diff --git a/lib/regex_internal.c b/lib/regex_internal.c index 55f6b66de0..6f755b214f 100644 --- a/lib/regex_internal.c +++ b/lib/regex_internal.c @@ -1286,7 +1286,10 @@ re_node_set_insert (re_node_set *set, Idx elem) if (__glibc_unlikely (set->nelem) == 0) { - /* We already guaranteed above that set->alloc != 0. */ + /* Although we already guaranteed above that set->alloc != 0 and + therefore set->elems != NULL, add a debug assertion to pacify + GCC 11.2 -fanalyzer. */ + DEBUG_ASSERT (set->elems); set->elems[0] = elem; ++set->nelem; return true; -- 2.39.5