https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98718
--- Comment #1 from Boris Kolpackov <boris at kolpackov dot net> --- Perhaps this is the same bug but with a simpler reproducer (it points to the same location): cat <<EOF >hello-format.mxx module; #include <string> export module hello:format; namespace hello { export std::string format (const std::string& n) { return "Hello, " + n + '!'; } } EOF cat <<EOF >hello.mxx module; #include <string> export module hello; export import :format; namespace hello { export void say (const std::string&); } EOF cat <<EOF >mapper.txt hello hello.gcm hello:format hello-format.gcm EOF g++ -std=c++2a -fmodules-ts -fmodule-mapper=mapper.txt -x c++ -o hello-format.gcm.o -c hello-format.mxx g++ -std=c++2a -fmodules-ts -fmodule-mapper=mapper.txt -x c++ -o hello.gcm.o -c hello.mxx hello.mxx:5:8: internal compiler error: in write_macro_maps, at cp/module.cc:16113 5 | export module hello; | ^~~~~~ 0xc60a67 module_state::write_macro_maps(elf_out*, location_map_info&, module_state_config*, unsigned int*) ../../gcc/gcc/cp/module.cc:16113 0xc659f1 module_state::write(elf_out*, cpp_reader*) ../../gcc/gcc/cp/module.cc:17727 0xc6bbfd finish_module_processing(cpp_reader*) ../../gcc/gcc/cp/module.cc:19747 0xb8a7a1 c_parse_final_cleanups() ../../gcc/gcc/cp/decl2.c:5178 0xf0b805 c_common_parse_file() ../../gcc/gcc/c-family/c-opts.c:1233