From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A323F3858018; Wed, 20 Jan 2021 07:48:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A323F3858018 From: "boris at kolpackov dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/98761] New: [modules] use of a module causes SIGSEGV at runtime Date: Wed, 20 Jan 2021 07:48:53 +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: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: boris at kolpackov dot net 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: Wed, 20 Jan 2021 07:48:53 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98761 Bug ID: 98761 Summary: [modules] use of a module causes SIGSEGV at runtime Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: boris at kolpackov dot net Target Milestone: --- The attached executable catches SIGSEGV when built with a module: $ g++ -std=3Dc++2a -fmodules-ts -x c++ -c format.mxx $ g++ -std=3Dc++2a -fmodules-ts -x c++ -c driver.cxx $ g++ -std=3Dc++2a -fmodules-ts -o test driver.o format.o $ ./test Segmentation fault (core dumped) $ gdb test core (gdb) bt #0 __memcpy_avx_unaligned () at ../sysdeps/x86_64/multiarch/memcpy-avx-unaligned.S:148 #1 0x0000000000402cc7 in std::char_traits::copy(char*, char const*, unsigned long) () #2 0x000000000040405c in std::__cxx11::basic_string, std::allocator >::_S_copy(char*, char const*, unsigned long) () #3 0x0000000000403f72 in std::__cxx11::basic_string, std::allocator >::_S_copy_chars(char*, char const*, char const*) () #4 0x00000000004039b0 in void std::__cxx11::basic_string, std::allocator >::_M_construct(c= har const*, char const*, std::forward_iterator_tag) () #5 0x0000000000403635 in void std::__cxx11::basic_string, std::allocator >::_M_construct_aux(char const*, char const*, std::__false_type) () #6 0x0000000000403337 in void std::__cxx11::basic_string, std::allocator >::_M_construct(c= har const*, char const*) () #7 0x0000000000403072 in std::__cxx11::basic_string, std::allocator >::basic_string(char const*, unsigned long, std::allocator const&) () #8 0x00000000004033fc in std::__cxx11::basic_string, std::allocator >::basic_string(std::__cxx11::basic_string, std::allocator >::__sv_wrapper, std::allocator const&) () #9 0x00000000004030ef in std::__cxx11::basic_string, std::allocator >::basic_string >, void>(std::basic_string_view > const&, std::allocator const&) () #10 0x000000000040266b in hello::format_hello[abi:cxx11](std::basic_string_view > const&) () #11 0x00000000004020be in main () The same code works fine if I get rid of the module. Re-ordering the object files during linking also helps: $ g++ -std=3Dc++2a -fmodules-ts -o test format.o driver.o=