From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id 0933B3850432; Wed, 31 Aug 2022 08:25:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0933B3850432 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661934328; bh=iMyEeR8O2XgZ0FIDxartLDl6kZXgLH7QPiir2FAynE4=; h=From:To:Subject:Date:From; b=PZbroY8T2p6H5xS1P7n9wq7sw97ipd671fPE/+YagG+6nvIAbOSS+yMSG7pVKnKRl MhhLE8vKM63IBJqkkcrv5pL0216qk+ddtxAT3sUuCJGzieuSNsw3EuDw+Wm9qj39a+ tdph6k0v2ebH1ld5uu4adeJAeB+rsvUYZl5bz3VE= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-2301] libcpp: Make static checkers happy about makeuname2c [PR106778] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/master X-Git-Oldrev: 437bde93dcde8309bb23ee255924c697e8e70df9 X-Git-Newrev: b3048b6ffb126a4624f66bad713fe6d1dc6dc13d Message-Id: <20220831082528.0933B3850432@sourceware.org> Date: Wed, 31 Aug 2022 08:25:28 +0000 (GMT) List-Id: https://gcc.gnu.org/g:b3048b6ffb126a4624f66bad713fe6d1dc6dc13d commit r13-2301-gb3048b6ffb126a4624f66bad713fe6d1dc6dc13d Author: Jakub Jelinek 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 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);