[llvm] r277266 - [X86] Fix lifetime of SMRange temporaries.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 30 04:31:24 PDT 2016
Author: d0k
Date: Sat Jul 30 06:31:24 2016
New Revision: 277266
URL: http://llvm.org/viewvc/llvm-project?rev=277266&view=rev
Log:
[X86] Fix lifetime of SMRange temporaries.
Found by asan -fsanitize-address-use-after-scope.
Modified:
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=277266&r1=277265&r2=277266&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Sat Jul 30 06:31:24 2016
@@ -2685,8 +2685,8 @@ bool X86AsmParser::MatchAndEmitATTInstru
// mnemonic was invalid.
if (std::count(std::begin(Match), std::end(Match), Match_MnemonicFail) == 4) {
if (!WasOriginallyInvalidOperand) {
- ArrayRef<SMRange> Ranges =
- MatchingInlineAsm ? EmptyRanges : Op.getLocRange();
+ SMRange OpRange = Op.getLocRange();
+ ArrayRef<SMRange> Ranges = MatchingInlineAsm ? EmptyRanges : OpRange;
return Error(IDLoc, "invalid instruction mnemonic '" + Base + "'",
Ranges, MatchingInlineAsm);
}
@@ -2839,8 +2839,8 @@ bool X86AsmParser::MatchAndEmitIntelInst
} else if (NumSuccessfulMatches > 1) {
assert(UnsizedMemOp &&
"multiple matches only possible with unsized memory operands");
- ArrayRef<SMRange> Ranges =
- MatchingInlineAsm ? EmptyRanges : UnsizedMemOp->getLocRange();
+ SMRange OpRange = UnsizedMemOp->getLocRange();
+ ArrayRef<SMRange> Ranges = MatchingInlineAsm ? EmptyRanges : OpRange;
return Error(UnsizedMemOp->getStartLoc(),
"ambiguous operand size for instruction '" + Mnemonic + "\'",
Ranges, MatchingInlineAsm);
More information about the llvm-commits
mailing list