From: Jakub Jelinek Date: Wed, 31 Aug 2022 08:22:36 +0000 (+0200) Subject: libcpp: Make static checkers happy about makeuname2c [PR106778] X-Git-Tag: basepoints/gcc-14~4906 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b3048b6ffb126a4624f66bad713fe6d1dc6dc13d;p=thirdparty%2Fgcc.git 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 PR preprocessor/106778 * makeuname2c.cc (write_nodes): Reverse order of && operands in assert. --- diff --git a/libcpp/makeuname2c.cc b/libcpp/makeuname2c.cc index f27e010dc6e5..2b3c70853149 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);