https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106951
Bug ID: 106951 Summary: Segmentation fault during compilation while using modules Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: huscar at gmail dot com Target Milestone: --- Created attachment 53579 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53579&action=edit Zipper preprocessor source Got a segmentation fault during compilation when porting a project over to modules. encountered on 12.2.0 (from docker gcc:12.2.0) and 11.2.0 (from apt) command used: g++ -c src/creatures.cpp -Ilibs/game-engine/include -std=c++20 -Wall -Wextra -Werror -fmodules-ts -o src/creatures.o -freport-bug compiler output: In module imported at libs/game-engine/src/engine.cpp:17:1, of module GameEngine.Main, imported at src/creatures.cpp:10: GameEngine.Components.Transform: note: unable to represent further imported source locations In module imported at libs/game-engine/src/engine.cpp:21:1: Segmentation fault 0x1b9fe76 internal_error(char const*, ...) ???:0 0x1bab157 pp_format(pretty_printer*, text_info*) ???:0 0x1bac520 pp_verbatim(pretty_printer*, char const*, ...) ???:0 0x1b9eca1 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*) ???:0 0x1b9f782 warning_at(unsigned int, int, char const*, ...) ???:0 0x9a6c07 do_warn_unused_parameter(tree_node*) ???:0 0x7cd12f finish_function(bool) ???:0 0x8c11c9 instantiate_decl(tree_node*, bool, bool) ???:0 0x8d5cab instantiate_pending_templates(int) ???:0 0x7db2df c_parse_final_cleanups() ???:0 Please submit a full bug report, with preprocessed source (by using -freport-bug). I've attached the preprocessor source attached. Segfault goes away after removing the line: import GameEngine.Main; The other import declaration in the same source file do not cause segmentation faults, nor does that same import (GameEngine.Main) from a different source file.