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

            Bug ID: 99336
           Summary: [modules] ICE combining unordered_map, memory, module
                    partitions
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: practicaldesignbook at gmail dot com
  Target Milestone: ---

Created attachment 50282
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50282&action=edit
Input files A.cpp and Test.cpp with preprocessed source to trigger bug.

version: gcc version 11.0.1 20210301 (experimental)
target: x86_64-pc-linux-gnu
build options: -disable-multilib --enable-languages=c,c++,fortran,lto,objc
--no-create --no-recursion

g++ produces an internal compiler error when combining an unordered_map with a
module partition, but only if the <memory> header is also included. My original
code used a std::unique_ptr, but in reducing the bug to the minimal amount of
code, I discovered that usage of std::unique_ptr is not required to trigger the
bug. The bug is triggered by the inclusion of the <memory> header. Note, the
code compiles correctly if the memory header is not included.

g++ -fmodules-ts -std=c++20 -c A.cpp Test.cpp
Test.cpp:1:8: internal compiler error: in tree_node, at cp/module.cc:9157
    1 | export module Test;
      |        ^~~~~~
0x69cde0 trees_out::tree_node(tree_node*)
        ../.././gcc/cp/module.cc:9157
0xa178c9 trees_out::core_vals(tree_node*)
        ../.././gcc/cp/module.cc:6027
0xa1aca4 trees_out::tree_node_vals(tree_node*)
        ../.././gcc/cp/module.cc:7168
0xa1aca4 trees_out::tree_value(tree_node*)
        ../.././gcc/cp/module.cc:8988
0xa16d64 trees_out::tree_node(tree_node*)
        ../.././gcc/cp/module.cc:9186
0xa178c9 trees_out::core_vals(tree_node*)
        ../.././gcc/cp/module.cc:6027
0xa1aca4 trees_out::tree_node_vals(tree_node*)
        ../.././gcc/cp/module.cc:7168
0xa1aca4 trees_out::tree_value(tree_node*)
        ../.././gcc/cp/module.cc:8988
0xa16d64 trees_out::tree_node(tree_node*)
        ../.././gcc/cp/module.cc:9186
0xa178c9 trees_out::core_vals(tree_node*)
        ../.././gcc/cp/module.cc:6027
0xa1aca4 trees_out::tree_node_vals(tree_node*)
        ../.././gcc/cp/module.cc:7168
0xa1aca4 trees_out::tree_value(tree_node*)
        ../.././gcc/cp/module.cc:8988
0xa16d64 trees_out::tree_node(tree_node*)
        ../.././gcc/cp/module.cc:9186
0xa178c9 trees_out::core_vals(tree_node*)
        ../.././gcc/cp/module.cc:6027
0xa1aca4 trees_out::tree_node_vals(tree_node*)
        ../.././gcc/cp/module.cc:7168
0xa1aca4 trees_out::tree_value(tree_node*)
        ../.././gcc/cp/module.cc:8988
0xa16d64 trees_out::tree_node(tree_node*)
        ../.././gcc/cp/module.cc:9186
0xa178c9 trees_out::core_vals(tree_node*)
        ../.././gcc/cp/module.cc:6027
0xa1aca4 trees_out::tree_node_vals(tree_node*)
        ../.././gcc/cp/module.cc:7168
0xa1aca4 trees_out::tree_value(tree_node*)
        ../.././gcc/cp/module.cc:8988
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to