]> Savannah Git Hosting - gnulib.git/commitdiff
regex: pacify GCC 11.2 -fanalyzer
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 31 Jul 2021 20:32:02 +0000 (13:32 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 31 Jul 2021 20:32:34 +0000 (13:32 -0700)
* lib/regex_internal.c (re_node_set_insert):
Add a debug assertion to pacify GCC 11.2 -fanalyzer.

ChangeLog
lib/regex_internal.c

index 80bcabd22739b29c087ee0d6fac02e5a3896811b..e3b868f91be8677ef5ca40629c8e2f8a94202eed 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2021-07-31  Paul Eggert  <eggert@cs.ucla.edu>
 
+       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.
index 55f6b66de0ef3888979abd55c9d6b44dad3f84b2..6f755b214f2a0eec036bca5fb2bf5fc68b6e0536 100644 (file)
@@ -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;