public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98761] New: [modules] use of a module causes SIGSEGV at runtime
@ 2021-01-20  7:48 boris at kolpackov dot net
  2021-01-20  7:50 ` [Bug c++/98761] " boris at kolpackov dot net
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: boris at kolpackov dot net @ 2021-01-20  7:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98761

            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=c++2a -fmodules-ts -x c++ -c format.mxx
$ g++ -std=c++2a -fmodules-ts -x c++ -c driver.cxx
$ g++ -std=c++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<char>::copy(char*, char const*,
unsigned long) ()
#2  0x000000000040405c in std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >::_S_copy(char*, char const*,
unsigned long) ()
#3  0x0000000000403f72 in std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >::_S_copy_chars(char*, char
const*, char const*) ()
#4  0x00000000004039b0 in void std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char
const*, char const*, std::forward_iterator_tag) ()
#5  0x0000000000403635 in void std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char
const*>(char const*, char const*, std::__false_type)
    ()
#6  0x0000000000403337 in void std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char
const*, char const*) ()
#7  0x0000000000403072 in std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >::basic_string(char const*,
unsigned long, std::allocator<char> const&) ()
#8  0x00000000004033fc in std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char>
>::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >::__sv_wrapper, std::allocator<char> const&) ()
#9  0x00000000004030ef in std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char>
>::basic_string<std::basic_string_view<char, std::char_traits<char> >,
void>(std::basic_string_view<char, std::char_traits<char> > const&,
std::allocator<char> const&) ()
#10 0x000000000040266b in
hello::format_hello[abi:cxx11](std::basic_string_view<char,
std::char_traits<char> > 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=c++2a -fmodules-ts -o test format.o driver.o

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/98761] [modules] use of a module causes SIGSEGV at runtime
  2021-01-20  7:48 [Bug c++/98761] New: [modules] use of a module causes SIGSEGV at runtime boris at kolpackov dot net
@ 2021-01-20  7:50 ` boris at kolpackov dot net
  2021-01-28 13:02 ` nathan at gcc dot gnu.org
  2024-03-07 20:36 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: boris at kolpackov dot net @ 2021-01-20  7:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98761

--- Comment #1 from Boris Kolpackov <boris at kolpackov dot net> ---
Created attachment 50011
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50011&action=edit
Reproducer

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/98761] [modules] use of a module causes SIGSEGV at runtime
  2021-01-20  7:48 [Bug c++/98761] New: [modules] use of a module causes SIGSEGV at runtime boris at kolpackov dot net
  2021-01-20  7:50 ` [Bug c++/98761] " boris at kolpackov dot net
@ 2021-01-28 13:02 ` nathan at gcc dot gnu.org
  2024-03-07 20:36 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: nathan at gcc dot gnu.org @ 2021-01-28 13:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98761

Nathan Sidwell <nathan at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-01-28
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #2 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
well this is exciting, I think the closest I got to code generation issues were
with incorrect vtables on occasion.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/98761] [modules] use of a module causes SIGSEGV at runtime
  2021-01-20  7:48 [Bug c++/98761] New: [modules] use of a module causes SIGSEGV at runtime boris at kolpackov dot net
  2021-01-20  7:50 ` [Bug c++/98761] " boris at kolpackov dot net
  2021-01-28 13:02 ` nathan at gcc dot gnu.org
@ 2024-03-07 20:36 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-03-07 20:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98761

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=112588
   Target Milestone|---                         |14.0
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
           Keywords|                            |wrong-code
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
The testcase no longer crashes with trunk since the PR112588 fix.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-07 20:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20  7:48 [Bug c++/98761] New: [modules] use of a module causes SIGSEGV at runtime boris at kolpackov dot net
2021-01-20  7:50 ` [Bug c++/98761] " boris at kolpackov dot net
2021-01-28 13:02 ` nathan at gcc dot gnu.org
2024-03-07 20:36 ` ppalka at gcc dot gnu.org

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).