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

            Bug ID: 98741
           Summary: [modules] ICE/SIGSEGV reading compiled module cluster
           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: ---

Created attachment 49998
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49998&action=edit
Build transcript

The following simple module causes ICE/SIGSEGV:

// hello.mxx
export module hello;
import <string_view>;
export namespace hello
{
  void say_hello (const std::string_view& name);
}

// hello.cxx
module hello;
import <iostream>;
namespace hello
{
  void say_hello (const std::string_view& n)
  {
    std::cout << "Hello, " << n << '!' << std::endl;
  }
}

c++ ../../../tests/modules/gcc2/gcc-install/include/c++/11.0.0/h{string_view}
c++ ../../../tests/modules/gcc2/gcc-install/include/c++/11.0.0/h{iostream}
c++ mxx{hello}
c++ cxx{hello}
In module imported at
/home/boris/work/build2/cxx20-modules-examples/hello-module/hello/hello.mxx:2:1,
of module hello, imported at
/home/boris/work/build2/cxx20-modules-examples/hello-module/hello/hello.cxx:1:
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.0/string_view:
error: failed to read compiled module cluster 137: Bad file data
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.0/string_view:
note: compiled module file is
‘/home/boris/work/build2/cxx20-modules-examples/hello-module/build/cc/b
uild/modules/cxx/string_view-02af41185b22.gcm’
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.0/string_view:
error: failed to read compiled module cluster 448: Bad file data
/home/boris/work/build2/cxx20-modules-examples/hello-module/hello/hello.cxx:5:30:
internal compiler error: Segmentation fault
0x180310b crash_signal
        ../../gcc/gcc/toplev.c:327
0xa16316 contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
        ../../gcc/gcc/tree.h:3451
0xc4a0b5 trees_in::key_mergeable(int, merge_kind, tree_node*, tree_node*,
tree_node*, tree_node*, bool)
        ../../gcc/gcc/cp/module.cc:10733
0xc3bd06 trees_in::decl_value()
        ../../gcc/gcc/cp/module.cc:8004
0xc41e8a trees_in::tree_node(bool)
        ../../gcc/gcc/cp/module.cc:9219
0xc5cc39 module_state::read_cluster(unsigned int)
        ../../gcc/gcc/cp/module.cc:14896
0xc66826 module_state::load_section(unsigned int, binding_slot*)
        ../../gcc/gcc/cp/module.cc:18036
0xc68a3c module_state::lazy_load(unsigned int, binding_slot*)
        ../../gcc/gcc/cp/module.cc:18685
0xc44657 trees_in::tree_node(bool)
        ../../gcc/gcc/cp/module.cc:9730
0xc47cd8 trees_in::decl_container()
        ../../gcc/gcc/cp/module.cc:10346
0xc3bc3a trees_in::decl_value()
        ../../gcc/gcc/cp/module.cc:7992
0xc41e8a trees_in::tree_node(bool)
        ../../gcc/gcc/cp/module.cc:9219
0xc5cc39 module_state::read_cluster(unsigned int)
        ../../gcc/gcc/cp/module.cc:14896
0xc66826 module_state::load_section(unsigned int, binding_slot*)
        ../../gcc/gcc/cp/module.cc:18036
0xc68a3c module_state::lazy_load(unsigned int, binding_slot*)
        ../../gcc/gcc/cp/module.cc:18685
0xc44657 trees_in::tree_node(bool)
        ../../gcc/gcc/cp/module.cc:9730
0xc42102 trees_in::tree_node(bool)
        ../../gcc/gcc/cp/module.cc:9269
0xc36133 trees_in::core_vals(tree_node*)
        ../../gcc/gcc/cp/module.cc:6624
0xc3810e trees_in::tree_node_vals(tree_node*)
        ../../gcc/gcc/cp/module.cc:7148
0xc3c012 trees_in::decl_value()
        ../../gcc/gcc/cp/module.cc:8043

The complete build transcript is attached.

Reply via email to