[Bug c++/99336] New: [modules] ICE combining unordered_map, memory, module partitions

2021-03-01 Thread practicaldesignbook at gmail dot com via Gcc-bugs
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=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  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  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  for instructions.

[Bug c++/98707] ICE using std::string in a module partition

2021-02-23 Thread practicaldesignbook at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98707

--- Comment #1 from Adam Singer  ---
The build from February 23, 2021, gcc version 11.0.0 20210223 (experimental), 
fixes this bug.

[Bug c++/98707] New: ICE using std::string in a module partition

2021-01-16 Thread practicaldesignbook at gmail dot com via Gcc-bugs
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=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  for instructions.