From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 58EEA3858D3C; Mon, 27 Dec 2021 09:42:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 58EEA3858D3C From: "tim152 at tgf dot pw" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/103844] New: [modules] ICE when exporting shared_ptr alias Date: Mon, 27 Dec 2021 09:42:22 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tim152 at tgf dot pw X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Dec 2021 09:42:22 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103844 Bug ID: 103844 Summary: [modules] ICE when exporting shared_ptr alias Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: tim152 at tgf dot pw Target Milestone: --- Created attachment 52066 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D52066&action=3Dedit preprocessed module source Exporting an alias to shared_ptr causes a compiler segfault on usage. This also breaks with unique_ptr, but works for other types. mod.cpp: module; #include export module tree; export template using p =3D std::shared_ptr; (mod.ii attached) main.cpp: import tree; int main() { p t; } % gcc -v Using built-in specs. COLLECT_GCC=3Dgcc COLLECT_LTO_WRAPPER=3D/usr/local/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto= -wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.0.0 20211226 (experimental) (GCC) ``` Compiled using % g++ mod.cpp -c -fmodules-ts -std=3Dc++20 -Wall -Wextra (no output) % g++ main.cpp -c -fmodules-ts -std=3Dc++20 -Wall -Wextra In file included from /usr/local/include/c++/12.0.0/bits/shared_ptr.h:53, from /usr/local/include/c++/12.0.0/memory:77, from mod.cpp:2, of module tree, imported at main.cpp:1: /usr/local/include/c++/12.0.0/bits/shared_ptr_base.h: In instantiation of =E2=80=98class std::__shared_ptr@tree=E2=80= =99: /usr/local/include/c++/12.0.0/bits/shared_ptr.h:124:11: required from =E2= =80=98class std::shared_ptr@tree=E2=80=99 main.cpp:4:11: required from here Segmentation fault 1442 | struct __has_esft_base | ^~~~~~~~~~~~~~~ 0x1180abf crash_signal ../../gcc/toplev.c:322 0xa88d16 tree_class_check(tree_node*, tree_code_class, char const*, int, ch= ar const*) ../../gcc/tree.h:3563 0xa88d16 get_originating_module_decl(tree_node*) ../../gcc/cp/module.cc:18339 0xa88e97 get_originating_module(tree_node*, bool) ../../gcc/cp/module.cc:18378 0xa301ef dump_module_suffix ../../gcc/cp/error.c:205 0xa301ef dump_module_suffix ../../gcc/cp/error.c:185 0xa30593 dump_aggr_type ../../gcc/cp/error.c:846 0xa3a352 decl_to_string ../../gcc/cp/error.c:3225 0xa3a352 cp_printer ../../gcc/cp/error.c:4396 0x20a99fa pp_format(pretty_printer*, text_info*) ../../gcc/pretty-print.c:1475 0x208be8b diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info= *) ../../gcc/diagnostic.c:1346 0x208c3b8 diagnostic_impl ../../gcc/diagnostic.c:1508 0x208ccfa error_at(unsigned int, char const*, ...) ../../gcc/diagnostic.c:1831 0xa01d80 duplicate_decls(tree_node*, tree_node*, bool, bool) ../../gcc/cp/decl.c:1795 0xabb1ca check_module_override ../../gcc/cp/name-lookup.c:3586 0xabb1ca pushdecl(tree_node*, bool) ../../gcc/cp/name-lookup.c:3724 0xabd54c do_pushdecl_with_scope ../../gcc/cp/name-lookup.c:4767 0xabd77a pushdecl_namespace_level(tree_node*, bool) ../../gcc/cp/name-lookup.c:6088 0xb6e95f tsubst_friend_class ../../gcc/cp/pt.c:11444 0xb6e95f instantiate_class_template_1 ../../gcc/cp/pt.c:12171 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See for instructions.=