diff options
author | Alexey Samsonov <samsonov@google.com> | 2013-08-28 08:30:47 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2013-08-28 08:30:47 +0000 |
commit | ead2d5a4be3012699252e015ce774733590bf9b0 (patch) | |
tree | 318ab413ba9121e368ae3656a5080ed62fcc20b2 /lib/Target | |
parent | 862b50420122e8be173ae534fcd1668c8c4be916 (diff) | |
download | external_llvm-ead2d5a4be3012699252e015ce774733590bf9b0.zip external_llvm-ead2d5a4be3012699252e015ce774733590bf9b0.tar.gz external_llvm-ead2d5a4be3012699252e015ce774733590bf9b0.tar.bz2 |
Fix use of uninitialized value added in r189400 (found by MemorySanitizer)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189456 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.cpp b/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.cpp index 633cd36..d7e8402 100644 --- a/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.cpp +++ b/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.cpp @@ -54,7 +54,7 @@ PPCMCExpr::EvaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout) const { MCValue Value; - if (Layout && !getSubExpr()->EvaluateAsRelocatable(Value, *Layout)) + if (!Layout || !getSubExpr()->EvaluateAsRelocatable(Value, *Layout)) return false; if (Value.isAbsolute()) { @@ -85,7 +85,7 @@ PPCMCExpr::EvaluateAsRelocatableImpl(MCValue &Res, break; } Res = MCValue::get(Result); - } else if (Layout) { + } else { MCContext &Context = Layout->getAssembler().getContext(); const MCSymbolRefExpr *Sym = Value.getSymA(); MCSymbolRefExpr::VariantKind Modifier = Sym->getKind(); @@ -118,8 +118,7 @@ PPCMCExpr::EvaluateAsRelocatableImpl(MCValue &Res, } Sym = MCSymbolRefExpr::Create(&Sym->getSymbol(), Modifier, Context); Res = MCValue::get(Sym, Value.getSymB(), Value.getConstant()); - } else - return false; + } return true; } |