1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

llvm-dwarfdump: Fix UB (unsequenced writes) introduced in e0fd87cc64d5

Unsequenced write due to "x &= f()" where 'f()' modifies 'x'.

Detected by the llvm-clang-x86_64-expensive-checks-win buildbot.
Investigated/identified by Galina - thanks!
This commit is contained in:
David Blaikie 2020-04-19 21:32:33 -07:00
parent 1082de0fcb
commit 0118194836

View File

@ -506,7 +506,8 @@ static bool handleBuffer(StringRef Filename, MemoryBufferRef Buffer,
if (filterArch(*Obj)) {
std::unique_ptr<DWARFContext> DICtx =
DWARFContext::create(*Obj, nullptr, "", RecoverableErrorHandler);
Result &= HandleObj(*Obj, *DICtx, Filename, OS);
if (!HandleObj(*Obj, *DICtx, Filename, OS))
Result = false;
}
}
else if (auto *Fat = dyn_cast<MachOUniversalBinary>(BinOrErr->get()))
@ -518,14 +519,16 @@ static bool handleBuffer(StringRef Filename, MemoryBufferRef Buffer,
if (filterArch(Obj)) {
std::unique_ptr<DWARFContext> DICtx =
DWARFContext::create(Obj, nullptr, "", RecoverableErrorHandler);
Result &= HandleObj(Obj, *DICtx, ObjName, OS);
if (!HandleObj(Obj, *DICtx, ObjName, OS))
Result = false;
}
continue;
} else
consumeError(MachOOrErr.takeError());
if (auto ArchiveOrErr = ObjForArch.getAsArchive()) {
error(ObjName, errorToErrorCode(ArchiveOrErr.takeError()));
Result &= handleArchive(ObjName, *ArchiveOrErr.get(), HandleObj, OS);
if (!handleArchive(ObjName, *ArchiveOrErr.get(), HandleObj, OS))
Result = false;
continue;
} else
consumeError(ArchiveOrErr.takeError());