[llvm] r199940 - Fix out of bounds access to the double regs array. Given the

Eric Christopher echristo at gmail.com
Thu Jan 23 13:41:10 PST 2014


Author: echristo
Date: Thu Jan 23 15:41:10 2014
New Revision: 199940

URL: http://llvm.org/viewvc/llvm-project?rev=199940&view=rev
Log:
Fix out of bounds access to the double regs array. Given the
code this looks correct, but could use review. The previous
was definitely not correct.

Modified:
    llvm/trunk/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp

Modified: llvm/trunk/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp?rev=199940&r1=199939&r2=199940&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp Thu Jan 23 15:41:10 2014
@@ -734,7 +734,7 @@ bool SparcAsmParser::matchRegisterName(c
         && !name.substr(1, 2).getAsInteger(10, intVal)
         && intVal >= 32 && intVal <= 62 && (intVal % 2 == 0)) {
       // FIXME: Check V9
-      RegNo = DoubleRegs[16 + intVal/2];
+      RegNo = DoubleRegs[intVal/2];
       RegKind = SparcOperand::rk_DoubleReg;
       return true;
     }





More information about the llvm-commits mailing list