[llvm] r192549 - TargetLowering: Don't index into empty string.

Will Dietz wdietz2 at illinois.edu
Sat Oct 12 20:08:49 PDT 2013


Author: wdietz2
Date: Sat Oct 12 22:08:49 2013
New Revision: 192549

URL: http://llvm.org/viewvc/llvm-project?rev=192549&view=rev
Log:
TargetLowering: Don't index into empty string.

(This is triggered by current lit tests)

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=192549&r1=192548&r2=192549&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Sat Oct 12 22:08:49 2013
@@ -2012,7 +2012,7 @@ void TargetLowering::LowerAsmOperandForC
 std::pair<unsigned, const TargetRegisterClass*> TargetLowering::
 getRegForInlineAsmConstraint(const std::string &Constraint,
                              MVT VT) const {
-  if (Constraint[0] != '{')
+  if (Constraint.empty() || Constraint[0] != '{')
     return std::make_pair(0u, static_cast<TargetRegisterClass*>(0));
   assert(*(Constraint.end()-1) == '}' && "Not a brace enclosed constraint?");
 





More information about the llvm-commits mailing list