[LLD] [COFF] Fix a ubsan error in pdb-type-server-missing.yaml
authorMartin Storsjö <martin@martin.st>
Thu, 8 Oct 2020 06:49:16 +0000 (09:49 +0300)
committerMartin Storsjö <martin@martin.st>
Mon, 12 Oct 2020 20:28:23 +0000 (23:28 +0300)
This error has been present since 5519e4da83d1abc666203.

Differential Revision: https://reviews.llvm.org/D89027

lld/COFF/DebugTypes.cpp

index febbd19..029da96 100644 (file)
@@ -1088,7 +1088,8 @@ void TypeMerger::mergeTypesWithGHash() {
   }
   parallelSort(entries, std::less<GHashCell>());
   log(formatv("ghash table load factor: {0:p} (size {1} / capacity {2})\n",
-              double(entries.size()) / tableSize, entries.size(), tableSize));
+              tableSize ? double(entries.size()) / tableSize : 0,
+              entries.size(), tableSize));
 
   // Find out how many type and item indices there are.
   auto mid =