From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 554303857C71; Sat, 7 May 2022 07:19:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 554303857C71 From: "deco33000 at yandex dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105512] New: compilation with -fmodules-ts and std=c++20 leads to segfault Date: Sat, 07 May 2022 07:19:08 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: deco33000 at yandex dot com 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 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: Sat, 07 May 2022 07:19:08 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105512 Bug ID: 105512 Summary: compilation with -fmodules-ts and std=3Dc++20 leads to segfault Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: deco33000 at yandex dot com Target Milestone: --- Hi, compiling with -fmodules-ts and -std=3Dc++20 leads to a segfault. With c++1= 7 no errors. Without std=3D switch, no segfault. But c++20 is required in my code, hence the report. Here is the reduced code: ----- main.cpp import hello; int main ( void ){ X::greeter("ok"); return 0; } -----mod.cxx module; #include #include #include export module hello; import sub_mod; namespace X { void greeter2 ( std::string_view const &name ){ std::string h =3D "exported greeter"; std::cout << "Bye " << name << "!" << h << "\n"; Y::g(); } } export { namespace X { void greeter ( std::string_view const &name ){ std::string h =3D "exported greeter"; std::cout << "Hello " << name << "!" << h << "\n"; greeter2("ff"); } } } -----mod_sub.cxx module; #include export module sub_mod; export { namespace Y { auto g (){ std::cout << "in out " << std::endl; } } } The following works with c++17 and c++20 flags (no issue): ----- mod_sub.cxx corrected (no global fragment): export module sub_mod; export { namespace Y { auto g ()-> int{ //std::cout << "in out " << std::endl; return 54; } } } and ----- mod.cxx corrected (prints g() directly): module; #include #include #include export module hello; import sub_mod; namespace X { void greeter2 ( std::string_view const &name ){ std::string h =3D "exported greeter"; std::cout << "Bye " << name << "!" << h << " " << Y::g() <<"\n"; } } export { namespace X { void greeter ( std::string_view const &name ){ std::string h =3D "exported greeter"; std::cout << "Hello " << name << "!" << h << "\n"; greeter2("ff"); } } } Thanks,=