https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98707
Bug ID: 98707
Summary: ICE using std::string in a module partition
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 49983
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49983&action=edit
Input files A.cpp and Test.cpp to trigger bug along with associated
preprocessed files
gcc version: gcc version 11.0.0 20210116 (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 strings and module
partitions (code attached). The error is not produced if the constructor of A
is changed from a std::string to an int or if the code is written without a
module partition.
g++ -std=c++20 -fmodules-ts -c -save-temps A.cpp Test.cpp
Test.cpp:1:9: internal compiler error: in insert, at cp/module.cc:4888
1 | export module Test;
| ^~~~~~
0x699623 trees_out::insert(tree_node*, walk_kind)
../.././gcc/cp/module.cc:4888
0xa119ee trees_out::add_indirects(tree_node*)
../.././gcc/cp/module.cc:7303
0xa14e50 trees_out::decl_node(tree_node*, walk_kind)
../.././gcc/cp/module.cc:8647
0xa15a42 trees_out::tree_node(tree_node*)
../.././gcc/cp/module.cc:9149
0xa15f0d trees_out::vec_chained_decls(tree_node*)
../.././gcc/cp/module.cc:4976
0xa19e1b trees_out::write_class_def(tree_node*)
../.././gcc/cp/module.cc:11712
0xa1baec depset::hash::find_dependencies()
../.././gcc/cp/module.cc:13202
0xa1bec4 module_state::write(elf_out*, cpp_reader*)
../.././gcc/cp/module.cc:17568
0xa1d19c finish_module_processing(cpp_reader*)
../.././gcc/cp/module.cc:19747
0x9b164b c_parse_final_cleanups()
../.././gcc/cp/decl2.c:5178
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.