https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124478
Bug ID: 124478
Summary: Failed to read module cache at compile time
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: printfne at gmail dot com
Target Milestone: ---
/// tools.cppm
export module tools;
import std;
export struct DedupeFilesPath {
std::vector<std::string> other_files;
};
/// minhash.cppm
export module dedupe:minhash;
export struct FileMinHash {
friend class LSH;
int file_minhash;
};
/// lsh.cppm
export module dedupe:lsh;
import :minhash;
import std;
import tools;
export struct LSH {
FileMinHash lsh;
std::vector<DedupeFilesPath> dedupe() {
lsh.file_minhash;
return {};
}
};
/// dedupe.cppm
export module dedupe;
export import :lsh;
export import :minhash;
/// text.cppm
export module text;
import std;
import tools;
import dedupe;
export DedupeFilesPath analyse_text(const std::string& path) {
return {};
}
/// main.cppm
import text;
int main() {
analyse_text("/test/path");
return 0;
}
/// command
mkdir build && cd build
g++-latest -std=c++26 -fmodules -c -fsearch-include-path bits/std.cc
g++-latest -std=c++26 -fmodules -c ../tools.cppm
g++-latest -std=c++26 -fmodules -c ../minhash.cppm
g++-latest -std=c++26 -fmodules -c ../lsh.cppm
g++-latest -std=c++26 -fmodules -c ../dedupe.cppm
g++-latest -std=c++26 -fmodules ../main.cpp
/// error message
In module imported at ../text.cppm:4:1,
of module text, imported at ../main.cpp:1:
dedupe: error: failed to read compiled module cluster 36: Bad file data
dedupe: note: compiled module file is ‘gcm.cache/dedupe.gcm’
dedupe: error: failed to read compiled module cluster 37: Bad file data
dedupe: error: failed to read compiled module cluster 38: Bad file data
dedupe: error: failed to read compiled module cluster 40: Bad file data
dedupe: error: failed to read compiled module cluster 41: Bad file data
dedupe: error: failed to read compiled module cluster 42: Bad file data
../main.cpp:4:17: fatal error: failed to load pendings for ‘std::vector’
4 | analyse_text("/test/path");
| ~~~~~~~~~~~~^~~~~~~~~~~~~~
compilation terminated.
/// g++ version
g++ (GCC) 16.0.1 20260220 (experimental)