[llvm] 12489b5 - llvm-dwarfdump: Fix UB (unsequenced writes) introduced in e0fd87cc64d5
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 19 21:35:17 PDT 2020
Author: David Blaikie
Date: 2020-04-19T21:35:04-07:00
New Revision: 12489b54746339b7304e79a34739e383ab186aaa
URL: https://github.com/llvm/llvm-project/commit/12489b54746339b7304e79a34739e383ab186aaa
DIFF: https://github.com/llvm/llvm-project/commit/12489b54746339b7304e79a34739e383ab186aaa.diff
LOG: 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!
Added:
Modified:
llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
index 31de753e7a19..9cae4dc3d5b3 100644
--- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
+++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
@@ -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());
More information about the llvm-commits
mailing list