From patchwork Sat Apr 22 08:02:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 86560 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1569030vqo; Sat, 22 Apr 2023 01:03:19 -0700 (PDT) X-Google-Smtp-Source: AKy350a1ioJnsed2IUjRSiuAM7TMeNGtjvz/eDUl8t4CuFttMK+4EULShm8Y5eEjKvt/7AszlwnT X-Received: by 2002:a17:906:49ce:b0:870:d9a:9ebb with SMTP id w14-20020a17090649ce00b008700d9a9ebbmr4071610ejv.38.1682150599650; Sat, 22 Apr 2023 01:03:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682150599; cv=none; d=google.com; s=arc-20160816; b=N5txAPEzBvJalRhNHUrALzvNCz2/6lz/xya+M8IsBBpGwrML3J6X0+BNxttUks8YnZ ZVoHueTTsE5cuxo41a/vB6xN44pTc8dp9qs03UZjKFwRWI8U1wiQBebTwJGFfIKUsjz5 1qlPBZkWvqG5R9GjOSIvJcqfNo+ogV5JzdId7M/Yof6GEGk/FENlBU1ksdGoJ3XUWTDV rt9hmhIYadTRZM+jQ9TIN8q8pzaCXifb5b1Jfu4+lzSNF/WJHH7cxkaJkl3ItUY0a1vk Gir6YlSlPGCUhHyWNexGA4r+vCdg7J/j7FYHs3Xc46UL+YqdbYgSyZQIdDyDzX4r9G8a xPHQ== 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:in-reply-to:mime-version:references:message-id :subject:cc:to:date:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=asSkljVcnPagf5ZmoV1WDGN6OjlSyUN6nZrvJ7bh9lA=; b=PbLqYMTHCQ1Ki7UbLXCrviTDmfvCnTuzs+4vtGdsch0tsyYd8w5UK6FHzJudozmdkt bIAfMhWnoIde1KFMkK9eSdDNol59bEE4Uz1dBHyH9Obbkzwr76ndNSaJm4SKN0wua7q8 3uQMQMmP4Hbi8u6hyufSkM9kXj+RI0l42IJ/VJhJHtxNV0YhXk4LcKbCo980KLKmBiBm FLwQMT5grhoGVe8FjPaFCDy5+Lf3hTi+d8wINTGm0LJqWr2ORGQyU2LSG2jPvTEeP/A5 u9Nu3oySOQAEBJdXDm55Kr9IayGIX+jJ47A2JwqUlg0lGjiJOLM1C2MMONvGcT7Z27sD T5qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=uyxE2PCK; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id o21-20020aa7c7d5000000b00506a6b0c4e1si5085226eds.335.2023.04.22.01.03.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 01:03:19 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=uyxE2PCK; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 03B0E385735A for ; Sat, 22 Apr 2023 08:03:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 03B0E385735A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682150597; bh=asSkljVcnPagf5ZmoV1WDGN6OjlSyUN6nZrvJ7bh9lA=; h=Date:To:Cc:Subject:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=uyxE2PCKPTmzXJhFXpUCRsY9QfMGWxrpfsNUhCxre/csbLdRqPjBY3KiriXUH3+ob zaGNM2dzUCxTv/A/BSIdJCl3eWQHyhmyImLI8jV/fPluGlpUN6zNIpvE4vwuVxY5n7 yfACpHI5YGs/aDCaB7qjcx9nF030JEGMsNsxTRQQ= 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 7EFBA3858C83 for ; Sat, 22 Apr 2023 08:02:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7EFBA3858C83 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-571-QWUKFWmKNa-Y0rChPqu_rQ-1; Sat, 22 Apr 2023 04:02:24 -0400 X-MC-Unique: QWUKFWmKNa-Y0rChPqu_rQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 32427800B35; Sat, 22 Apr 2023 08:02:24 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.194.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E8AEA492C13; Sat, 22 Apr 2023 08:02:23 +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 33M82LK92207242 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Sat, 22 Apr 2023 10:02:21 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 33M82Kd82207241; Sat, 22 Apr 2023 10:02:20 +0200 Date: Sat, 22 Apr 2023 10:02:20 +0200 To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix up bootstrap with GCC 4.[89] after RAII auto_mpfr and autp_mpz [PR109589] Message-ID: References: <20230418133942.1FAC113581@imap2.suse-dmz.suse.de> MIME-Version: 1.0 In-Reply-To: <20230418133942.1FAC113581@imap2.suse-dmz.suse.de> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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?1763862747117783720?= X-GMAIL-MSGID: =?utf-8?q?1763862747117783720?= Hi! On Tue, Apr 18, 2023 at 03:39:41PM +0200, Richard Biener via Gcc-patches wrote: > The following adds two RAII classes, one for mpz_t and one for mpfr_t > making object lifetime management easier. Both formerly require > explicit initialization with {mpz,mpfr}_init and release with > {mpz,mpfr}_clear. This unfortunately broke bootstrap when using GCC 4.8.x or 4.9.x as it uses deleted friends which weren't supported until PR62101 fixed them in 2014 for GCC 5. The following patch adds an workaround, not deleting those friends for those old versions. While it means if people add those mp*_{init{,2},clear} calls on auto_mp* objects they won't notice when doing non-bootstrap builds using very old system compilers, people should be bootstrapping their changes and it will be caught during bootstraps even when starting with those old compilers, plus most people actually use much newer compilers when developing. Bootstrapped/regtested on x86_64-linux and i686-linux (with gcc 12.1.1 as system compiler) and powerpc64-linux and powerpc64le-linux (with gcc 4.8.5 as system compiler, where it previously failed bootstrap). Ok for trunk? 2023-04-22 Jakub Jelinek PR bootstrap/109589 * system.h (class auto_mpz): Workaround PR62101 bug in GCC 4.8 and 4.9. * realmpfr.h (class auto_mpfr): Likewise. Jakub --- gcc/system.h.jj 2023-04-20 09:36:09.097375720 +0200 +++ gcc/system.h 2023-04-21 20:13:09.212049563 +0200 @@ -714,8 +714,11 @@ public: auto_mpz (const auto_mpz &) = delete; auto_mpz &operator= (const auto_mpz &) = delete; +#if GCC_VERSION < 4008 || GCC_VERSION >= 5000 + /* GCC 4.8 and 4.9 don't support this, only fixed in PR62101 for 5.0. */ friend void mpz_clear (auto_mpz&) = delete; friend void mpz_init (auto_mpz&) = delete; +#endif private: mpz_t m_mpz; --- gcc/realmpfr.h.jj 2023-04-20 09:36:09.066376175 +0200 +++ gcc/realmpfr.h 2023-04-21 20:13:36.191663089 +0200 @@ -37,9 +37,12 @@ public: auto_mpfr (const auto_mpfr &) = delete; auto_mpfr &operator= (const auto_mpfr &) = delete; +#if GCC_VERSION < 4008 || GCC_VERSION >= 5000 + /* GCC 4.8 and 4.9 don't support this, only fixed in PR62101 for 5.0. */ friend void mpfr_clear (auto_mpfr&) = delete; friend void mpfr_init (auto_mpfr&) = delete; friend void mpfr_init2 (auto_mpfr&, mpfr_prec_t) = delete; +#endif private: mpfr_t m_mpfr;