https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116805
Bug ID: 116805 Summary: -fno-module-lazy breaks thread module when compiled after format module Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gcc at richy dot net Target Milestone: --- Created attachment 59171 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59171&action=edit Collection of *.ii files richard@microserver:~/scratch/broken> gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/home/richard/gcc/lib/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure --host=x86_64-pc-linux-gnu --prefix=/home/richard/gcc --enable-threads --enable-language=c,c++ --disable-multilib Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 15.0.0 20240917 (experimental) (GCC) Issued commands below, *.ii files attached. g++ -std=c++2b -fmodules-ts -fconcepts -fno-module-lazy -Wall -O3 -g -fPIC -save-temps -x c++-system-header format g++ -std=c++2b -fmodules-ts -fconcepts -fno-module-lazy -Wall -O3 -g -fPIC -save-temps -x c++-system-header thread g++ -std=c++2b -fmodules-ts -fconcepts -fno-module-lazy -Wall -O3 -g -fPIC -save-temps -c -o ex2.o -x c++ ex2.ixx In module imported at ex2.ixx:3:1: /home/richard/gcc/include/c++/15.0.0/thread: error: failed to read compiled module cluster 1884: Bad file data /home/richard/gcc/include/c++/15.0.0/thread: note: compiled module file is ‘gcm.cache/./home/richard/gcc/include/c++/15.0.0/thread.gcm’ /home/richard/gcc/include/c++/15.0.0/thread: error: failed to read compiled module: Bad file data /home/richard/gcc/include/c++/15.0.0/thread: fatal error: returning to the gate for a mechanical issue compilation terminated. make: *** [Makefile:80: ex2.o] Error 1 Source code: export module sorttools.sorts:foobar; import <thread>; export namespace sorttools::sorts::foobar { class Pieces { public: std::jthread hello{}; }; } On 15.0.0 removing the -fno-module-lazy flag will allow this to compile, as does swapping the order of format/thread.