Skip to content

Commit bf25cc6

Browse files
committed
Warn on cache collision
1 parent eeef677 commit bf25cc6

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/comp_cache.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ class CompCache final: public CompCacheIF {
121121
if (out_node != nullptr) *out_node = (act_id < compile_nodes.size()) ? compile_nodes[act_id] : -1;
122122
return true;
123123
}
124+
// Hashkey matched but the (exact, content-comparing) equals() rejected it, oops
125+
if (entry(act_id).get_hashkey() == comp.get_hashkey()) {
126+
verb_print(1, "WARNING: hash collision -- cache entry ID " << act_id
127+
<< " has the same hashkey (0x" << std::hex << comp.get_hashkey() << std::dec
128+
<< ") as the looked-up component but DIFFERENT content."
129+
<< " Under --prob 1 this would have been a wrong cache hit.");
130+
}
124131
act_id = entry(act_id).next_bucket_element();
125132
}
126133
return false;

0 commit comments

Comments
 (0)