public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-2301] libcpp: Make static checkers happy about makeuname2c [PR106778]
@ 2022-08-31  8:25 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2022-08-31  8:25 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:b3048b6ffb126a4624f66bad713fe6d1dc6dc13d

commit r13-2301-gb3048b6ffb126a4624f66bad713fe6d1dc6dc13d
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Aug 31 10:22:36 2022 +0200

    libcpp: Make static checkers happy about makeuname2c [PR106778]
    
    The assertion ensures that we point within the image and at a byte
    we haven't touched yet (or at least that it isn't the first byte
    of an already stored tree), some static checker was unhappy about
    first checking that it is zero and only afterwards checking that it
    is within bounds.
    
    2022-08-31  Jakub Jelinek  <jakub@redhat.com>
    
            PR preprocessor/106778
            * makeuname2c.cc (write_nodes): Reverse order of && operands in
            assert.

Diff:
---
 libcpp/makeuname2c.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcpp/makeuname2c.cc b/libcpp/makeuname2c.cc
index f27e010dc6e..2b3c7085314 100644
--- a/libcpp/makeuname2c.cc
+++ b/libcpp/makeuname2c.cc
@@ -451,7 +451,7 @@ write_nodes (struct node *n, size_t off)
 {
   for (; n; n = n->sibling)
     {
-      assert (tree[off] == 0 && off < tree_size);
+      assert (off < tree_size && tree[off] == 0);
       if (n->key_len > 1)
 	{
 	  assert (n->key_len < 64);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-31  8:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-31  8:25 [gcc r13-2301] libcpp: Make static checkers happy about makeuname2c [PR106778] Jakub Jelinek

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).