bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: bug-gnulib@gnu.org
Cc: Paul Eggert <eggert@cs.ucla.edu>
Subject: [PATCH] regex: pacify GCC 11.2 -fanalyzer
Date: Sat, 31 Jul 2021 13:32:47 -0700	[thread overview]
Message-ID: <20210731203247.391949-1-eggert@cs.ucla.edu> (raw)

* 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 80bcabd22..e3b868f91 100644
--- 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.
diff --git a/lib/regex_internal.c b/lib/regex_internal.c
index 55f6b66de..6f755b214 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.31.1



                 reply	other threads:[~2021-07-31 20:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210731203247.391949-1-eggert@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).