]> Savannah Git Hosting - gnulib.git/commitdiff
regex: pacify GCC 11.2.1's -fanalyzer
authorJim Meyering <meyering@fb.com>
Sun, 1 Aug 2021 19:26:49 +0000 (12:26 -0700)
committerJim Meyering <meyering@fb.com>
Sun, 1 Aug 2021 19:30:57 +0000 (12:30 -0700)
* lib/regex_internal.c (re_node_set_merge):
Add a debug assertion to pacify GCC 11.2.1's -fanalyzer.

ChangeLog
lib/regex_internal.c

index dbd0598ec5eca59e1485d1ecac1a582aa5a2ccb9..21fbc52e30c75e686fdcb763e9711c43918c273f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2021-08-01  Jim Meyering  <meyering@fb.com>
+
+       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  <bruno@clisp.org>
 
        limits-h tests: Add tests for BOOL_MAX and BOOL_WIDTH.
index 6f755b214f2a0eec036bca5fb2bf5fc68b6e0536..aefcfa2f52e68c6a648d8c1434027ef25aec082f 100644 (file)
@@ -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;