public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "ppalka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/99426] [modules] failed to read compiled module cluster 1186: Bad file data Date: Fri, 12 Apr 2024 19:52:39 +0000 [thread overview] Message-ID: <bug-99426-4-OtdoLBEnjb@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-99426-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99426 --- Comment #11 from Patrick Palka <ppalka at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:716af95fd454871473c4b118b8412b6a68459b75 commit r14-9948-716af95fd454871473c4b118b8412b6a68459b75 Author: Patrick Palka <ppalka@redhat.com> c++/modules: local type merging [PR99426] One known missing piece in the modules implementation is merging of a streamed-in local type (class or enum) with the corresponding in-TU version of the local type. This missing piece turns out to cause a hard-to-reduce use-after-free GC issue due to the entity_ary not being marked as a GC root (deliberately), and manifests as a serialization error on stream-in as in PR99426 (see comment #6 for a reduction). It's also reproducible on trunk when running the xtreme-header tests without -fno-module-lazy. This patch implements this missing piece, making us merge such local types according to their position within the containing function's definition, analogous to how we merge FIELD_DECLs of a class according to their index in the TYPE_FIELDS list. PR c++/99426 gcc/cp/ChangeLog: * module.cc (merge_kind::MK_local_type): New enumerator. (merge_kind_name): Update. (trees_out::chained_decls): Move BLOCK-specific handling of DECL_LOCAL_DECL_P decls to ... (trees_out::core_vals) <case BLOCK>: ... here. Stream BLOCK_VARS manually. (trees_in::core_vals) <case BLOCK>: Stream BLOCK_VARS manually. Handle deduplicated local types.. (trees_out::key_local_type): Define. (trees_in::key_local_type): Define. (trees_out::get_merge_kind) <case FUNCTION_DECL>: Return MK_local_type for a local type. (trees_out::key_mergeable) <case FUNCTION_DECL>: Use key_local_type. (trees_in::key_mergeable) <case FUNCTION_DECL>: Likewise. (trees_in::is_matching_decl): Be flexible with type mismatches for local entities. (trees_in::register_duplicate): Also register the DECL_TEMPLATE_RESULT of a TEMPLATE_DECL as a duplicate. (depset_cmp): Return 0 for equal IDENTIFIER_HASH_VALUEs. gcc/testsuite/ChangeLog: * g++.dg/modules/merge-17.h: New test. * g++.dg/modules/merge-17_a.H: New test. * g++.dg/modules/merge-17_b.C: New test. * g++.dg/modules/xtreme-header-7_a.H: New test. * g++.dg/modules/xtreme-header-7_b.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
next prev parent reply other threads:[~2024-04-12 19:52 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-06 7:54 [Bug c++/99426] New: " alexander.lelyakin at googlemail dot com 2021-03-09 15:56 ` [Bug c++/99426] " alexander.lelyakin at googlemail dot com 2021-03-12 5:40 ` alexander.lelyakin at googlemail dot com 2021-03-24 19:38 ` alexander.lelyakin at googlemail dot com 2021-03-30 1:34 ` mpolacek at gcc dot gnu.org 2021-03-30 6:50 ` alexander.lelyakin at googlemail dot com 2022-09-08 4:39 ` markmigm at gmail dot com 2024-02-27 2:15 ` ppalka at gcc dot gnu.org 2024-02-29 18:04 ` ppalka at gcc dot gnu.org 2024-04-03 21:19 ` ppalka at gcc dot gnu.org 2024-04-07 12:33 ` nickbegg at gmail dot com 2024-04-07 14:56 ` ppalka at gcc dot gnu.org 2024-04-07 20:49 ` nickbegg at gmail dot com 2024-04-12 19:52 ` ppalka at gcc dot gnu.org [this message] 2024-04-12 19:53 ` ppalka at gcc dot gnu.org
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=bug-99426-4-OtdoLBEnjb@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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).