public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jason Merrill <jason@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-8523] c++: fix modules binfo merging Date: Tue, 8 Jun 2021 13:24:24 +0000 (GMT) [thread overview] Message-ID: <20210608132425.022FA383802C@sourceware.org> (raw) https://gcc.gnu.org/g:03346eb2ccd72fcc0ebe71a5b12e850078ec10ab commit r11-8523-g03346eb2ccd72fcc0ebe71a5b12e850078ec10ab Author: Jason Merrill <jason@redhat.com> Date: Mon Jun 7 17:51:24 2021 -0400 c++: fix modules binfo merging My coming fix for PR91706 caused some regressions in the modules testsuite. This turned out to be because the change to properly use the base subobject BINFO as BASELINK_BINFO hit problems with the code for merging binfos. The tree reader needed a typo fix. The duplicate_hash function was crashing on the BINFO for a variadic base in <variant>. I started fixing the hash function, but then noticed that there's no ::equal function defined; duplicate_hash just uses pointer equality, so we might as well also use the normal pointer hash for the moment. gcc/cp/ChangeLog: * module.cc (duplicate_hash::hash): Comment out. (trees_in::tree_value): Adjust loop counter. Diff: --- gcc/cp/module.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 02c19f55548..b97b1bcb2f8 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -2820,12 +2820,16 @@ struct merge_key { struct duplicate_hash : nodel_ptr_hash<tree_node> { +#if 0 + /* This breaks variadic bases in the xtreme_header tests. Since ::equal is + the default pointer_hash::equal, let's use the default hash as well. */ inline static hashval_t hash (value_type decl) { if (TREE_CODE (decl) == TREE_BINFO) decl = TYPE_NAME (BINFO_TYPE (decl)); return hashval_t (DECL_UID (decl)); } +#endif }; /* Hashmap of merged duplicates. Usually decls, but can contain @@ -8909,7 +8913,7 @@ trees_in::tree_value () dump (dumper::MERGE) && dump ("Deduping binfo %N[%u]", type, ix); existing = TYPE_BINFO (type); - while (existing && ix) + while (existing && ix--) existing = TREE_CHAIN (existing); if (existing) register_duplicate (t, existing);
reply other threads:[~2021-06-08 13:24 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210608132425.022FA383802C@sourceware.org \ --to=jason@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /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: linkBe 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).