From: Peter Collingbourne Date: Tue, 24 Feb 2015 01:12:53 +0000 (+0000) Subject: CodeGenModule::EmitVTableBitSetEntries: Add check for identical bit set entries. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f27eb8e844e417793e1841b2e8a046ac1239aea4;p=clang CodeGenModule::EmitVTableBitSetEntries: Add check for identical bit set entries. No two elements of this array should be the same, but the standard library may pass the same element as both arguments to this function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230293 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGVTables.cpp b/lib/CodeGen/CGVTables.cpp index 14116e498e..2e8471eeb6 100644 --- a/lib/CodeGen/CGVTables.cpp +++ b/lib/CodeGen/CGVTables.cpp @@ -876,6 +876,9 @@ void CodeGenModule::EmitVTableBitSetEntries(llvm::GlobalVariable *VTable, // Sort the bit set entries for determinism. std::sort(BitsetEntries.begin(), BitsetEntries.end(), [](llvm::MDTuple *T1, llvm::MDTuple *T2) { + if (T1 == T2) + return false; + StringRef S1 = cast(T1->getOperand(0))->getString(); StringRef S2 = cast(T2->getOperand(0))->getString(); if (S1 < S2)