From: Jakub Jelinek <jakub@redhat.com>
To: Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: [PATCH] Fix up bootstrap with GCC 4.[89] after RAII auto_mpfr and autp_mpz [PR109589]
Date: Sat, 22 Apr 2023 10:02:20 +0200 [thread overview]
Message-ID: <ZEOUjFpUiri7kUOp@tucnak> (raw)
In-Reply-To: <20230418133942.1FAC113581@imap2.suse-dmz.suse.de>
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 <jakub@redhat.com>
PR bootstrap/109589
* system.h (class auto_mpz): Workaround PR62101 bug in GCC 4.8 and 4.9.
* realmpfr.h (class auto_mpfr): Likewise.
--- 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;
Jakub
next prev parent reply other threads:[~2023-04-22 8:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 13:39 [PATCH] RAII auto_mpfr and autp_mpz Richard Biener
2023-04-22 8:02 ` Jakub Jelinek [this message]
2023-04-22 17:37 ` [PATCH] Fix up bootstrap with GCC 4.[89] after RAII auto_mpfr and autp_mpz [PR109589] Richard Biener
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZEOUjFpUiri7kUOp@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).