From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 633093850432 for ; Wed, 31 Aug 2022 08:50:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 633093850432 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661935802; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type; bh=Z8wYsLY4PwGNM5I4N6cm8XtJmsu4Mg0aiuS8PJnjHiY=; b=aLr/5cm4+ylofjaqmXjZKK5YtdKSuwbcApoML6fzInDU9LUlBfvFHFILBF5t/5q7wc2uc9 a7igcc3PukAAag+7KvGoD6PfM10cIFR1t6P24r5IE4f9bHAllD+ZXG+ed6jNyo30rtrQun cRB2DlHAwmuJYwqs/ASN9xcyub6GGvo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-503-rQvHL-ZfP-6cLhr4Jy0qdQ-1; Wed, 31 Aug 2022 04:50:00 -0400 X-MC-Unique: rQvHL-ZfP-6cLhr4Jy0qdQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6B265803520 for ; Wed, 31 Aug 2022 08:50:00 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1866440CF8EE for ; Wed, 31 Aug 2022 08:49:59 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 27V8nvlF166563 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Wed, 31 Aug 2022 10:49:58 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 27V8nviK166562 for gcc-patches@gcc.gnu.org; Wed, 31 Aug 2022 10:49:57 +0200 Date: Wed, 31 Aug 2022 10:49:56 +0200 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [committed] libcpp: Make static checkers happy about makeuname2c [PR106778] Message-ID: Reply-To: Jakub Jelinek MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi! 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. Obviously nothing changes on the generated uname2c.h and while I've bootstrapped/regtested it on x86_64-linux and i686-linux, the generator is only used when built and run by hand (note, when updating to a newer Unicode it won't be just a matter of rerunning it against newer files, but one needs to update the generated_ranges according to Table 4-8 in the sources too). Committed to trunk as obvious. 2022-08-31 Jakub Jelinek PR preprocessor/106778 * makeuname2c.cc (write_nodes): Reverse order of && operands in assert. --- libcpp/makeuname2c.cc.jj 2022-08-26 09:24:12.122615517 +0200 +++ libcpp/makeuname2c.cc 2022-08-30 17:28:20.171052344 +0200 @@ -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); Jakub