From: Richard Biener <richard.guenther@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Richard Biener <rguenther@suse.de>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] ggc-common: Fix save PCH assertion
Date: Sat, 3 Feb 2024 14:28:14 +0100 [thread overview]
Message-ID: <5C80FDF3-7774-4DFF-BCB1-C1286EEA6B98@gmail.com> (raw)
In-Reply-To: <Zb36hTYHAspztKQV@tucnak>
> Am 03.02.2024 um 09:36 schrieb Jakub Jelinek <jakub@redhat.com>:
>
> Hi!
>
> We are getting a gnuradio PCH ICE
> /usr/include/pybind11/stl.h:447:1: internal compiler error: in gt_pch_save, at ggc-common.cc:693
> 0x1304e7d gt_pch_save(_IO_FILE*)
> ../../gcc/ggc-common.cc:693
> 0x12a45fb c_common_write_pch()
> ../../gcc/c-family/c-pch.cc:175
> 0x18ad711 c_parse_final_cleanups()
> ../../gcc/cp/decl2.cc:5062
> 0x213988b c_common_parse_file()
> ../../gcc/c-family/c-opts.cc:1319
> (unfortunately it isn't reproduceable always, but often needs
> up to 100 attempts, isn't reproduceable in a cross etc.).
> The bug is in the assertion I've added in gt_pch_save when adding
> relocation support for the PCH files in case they happen not to be
> mmapped at the selected address.
> addr is a relocated address which points to a location in the PCH
> blob (starting at mmi.preferred_base, with mmi.size bytes) which contains
> a pointer that needs to be relocated. So the assertion is meant to
> verify the address is within the PCH blob, obviously it needs to be
> equal or above mmi.preferred_base, but I got the other comparison wrong
> and when one is very unlucky and the last sizeof (void *) bytes of the
> blob happen to be a pointer which needs to be relocated, such as on the
> s390x host addr 0x8008a04ff8, mmi.preferred_base 0x8000000000 and
> mmi.size 0x8a05000, addr + sizeof (void *) is equal to mmi.preferred_base +
> mmi.size and that is still fine, both addresses are end of something.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, plus tested on s390x
> on the testcase which was ICEing in 1-100 iterations and there it survived
> 7750 attempts without ICE (forgot to stop it earlier), ok for trunk?
>
Ok
Richard
> 2024-02-03 Jakub Jelinek <jakub@redhat.com>
>
> * ggc-common.cc (gt_pch_save): Allow addr to be equal to
> mmi.preferred_base + mmi.size - sizeof (void *).
>
> --- gcc/ggc-common.cc.jj 2024-01-03 11:51:39.397622018 +0100
> +++ gcc/ggc-common.cc 2024-02-02 17:33:13.106727473 +0100
> @@ -692,7 +692,7 @@ gt_pch_save (FILE *f)
> {
> gcc_assert ((uintptr_t) addr >= (uintptr_t) mmi.preferred_base
> && ((uintptr_t) addr + sizeof (void *)
> - < (uintptr_t) mmi.preferred_base + mmi.size));
> + <= (uintptr_t) mmi.preferred_base + mmi.size));
> if (addr == last_addr)
> continue;
> if (last_addr == NULL)
>
> Jakub
>
prev parent reply other threads:[~2024-02-03 13:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-03 8:34 Jakub Jelinek
2024-02-03 13:28 ` Richard Biener [this message]
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=5C80FDF3-7774-4DFF-BCB1-C1286EEA6B98@gmail.com \
--to=richard.guenther@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--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).