From patchwork Wed Aug 31 08:49:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 856 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:ecc5:0:0:0:0:0 with SMTP id s5csp127244wro; Wed, 31 Aug 2022 01:50:46 -0700 (PDT) X-Google-Smtp-Source: AA6agR6CqrpLeM9MS2T4Koga5RoY794wIlqJ0Z5sTpbdyGhmmP5YnIANUdaJ7ohRMEfwMZmKQs0R X-Received: by 2002:a17:907:2d86:b0:741:662f:f1f7 with SMTP id gt6-20020a1709072d8600b00741662ff1f7mr11395280ejc.34.1661935846216; Wed, 31 Aug 2022 01:50:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661935846; cv=none; d=google.com; s=arc-20160816; b=wRIsbcfXy64PcBJl3JDvme8ZK5mrzi2g5m+uIlrxxUzoDktQegdSGN906JmtA0LDRa Oa9XHQZ/3jchUnYq1PvGy0b9FPsOuIYeb8suFZuxOYuGB1Ap0d0Y0F39P1tTMBUmzjba F2icAlyqQWdVthcFUblgQPJVbhEhDPDV5MVq53pXo2K4JNsXfG2bmU/cSlFurwZ/8TYu hEncbXFW5ilJKp/CQTlvh7SO0RWJL8iZbr62uR4wlQiBynJgT6TGlZtos6e7pgXOmFwJ EOcbGF0fCs7H4Z1Ww+rnzVFXVAnV8PUxRXvca/hLOxumujhpTpes8dd4kMuUPVH45v4p 5SIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=Z8wYsLY4PwGNM5I4N6cm8XtJmsu4Mg0aiuS8PJnjHiY=; b=Qd6Bp9BBpRkARDE7uhDRpajvmtjCdH+7dKbD0FDow8NG43PROfZrl1iyilq3rrSvdJ UKO1VsJvKHhQrSr5u2RRgM0iMJna9Ug9SoyHfJnitXN0gX0AplAAGevSQJgSOb4BozTa /tOFjHkQ53Y/p2qby9W0v/GfV+VyqL0IAxJCasWMljKoHNdyD9ls2G1qIr05dzi8+OXb hZADfLG1l08FemvKKoh7gAbL73HqZnpRyRvwb/fuzDokywP92T4ErP2mli28snsHLiOD rexEr7puQoEXDrmjNlFYe8kHsojD3MKOyHIEgOkR4QhXpk2F4/25iDXpC+t8VqkGACAN SusA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=lBjR6bxJ; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id dp21-20020a170906c15500b007416bd58459si7975305ejc.516.2022.08.31.01.50.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 01:50:46 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=lBjR6bxJ; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2A20C383CCEB for ; Wed, 31 Aug 2022 08:50:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A20C383CCEB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661935845; bh=Z8wYsLY4PwGNM5I4N6cm8XtJmsu4Mg0aiuS8PJnjHiY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=lBjR6bxJzcZRg2QxhZDMrJ0TwEFZPNjrr0ag0uEDWaPxtBW02FtbyHFNO5tu9IzPF LCdh4BqKy2bymvM13LHrMsWpic/GL1vxdkTEBLmVKEBSocvMSGIjhvBhZrHbWxqgi1 Ik/F+ndMCwgNOlqHN86JT4E5pk6CRCBhVktyZex0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 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 To: gcc-patches@gcc.gnu.org Subject: [committed] libcpp: Make static checkers happy about makeuname2c [PR106778] Message-ID: 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-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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1742666042060619218?= X-GMAIL-MSGID: =?utf-8?q?1742666042060619218?= 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. Jakub --- 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);