[lld] r218548 - Fix crash bug on Windows.
Rui Ueyama
ruiu at google.com
Fri Sep 26 15:27:42 PDT 2014
Author: ruiu
Date: Fri Sep 26 17:27:42 2014
New Revision: 218548
URL: http://llvm.org/viewvc/llvm-project?rev=218548&view=rev
Log:
Fix crash bug on Windows.
Mutating the DenseMap here seems to cause the Windows executable
to crash. Don't use operator[] to access possibly nonexistent key.
Modified:
lld/trunk/lib/Core/Resolver.cpp
Modified: lld/trunk/lib/Core/Resolver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/Resolver.cpp?rev=218548&r1=218547&r2=218548&view=diff
==============================================================================
--- lld/trunk/lib/Core/Resolver.cpp (original)
+++ lld/trunk/lib/Core/Resolver.cpp Fri Sep 26 17:27:42 2014
@@ -305,8 +305,10 @@ void Resolver::markLive(const Atom *atom
if (const DefinedAtom *defAtom = dyn_cast<DefinedAtom>(atom)) {
for (const Reference *ref : *defAtom)
markLive(ref->target());
- for (const Atom *target : _reverseRef[defAtom])
- markLive(target);
+ auto it = _reverseRef.find(defAtom);
+ if (it != _reverseRef.end())
+ for (const Atom *target : it->second)
+ markLive(target);
}
}
More information about the llvm-commits
mailing list