diff options
| author | 2012-03-16 19:12:11 -0700 | |
|---|---|---|
| committer | 2012-03-16 19:12:11 -0700 | |
| commit | 98dc5d7692591b7e9d4e576407f138f80c0a1e64 (patch) | |
| tree | c69c1d9cb6fcf975c7284c49290e5052a45c08db /src/compiler/codegen/RallocUtil.cc | |
| parent | 594e76f8d5fc7c8e419ead1185cfe91dd9036d0c (diff) | |
Fix out-of-bounds memory access
Valgrind flagged a pair of out-of-bounds memory accesses. Reorder
the compound statement to correct.
Thanks Valgrind!
Change-Id: I9cd9c4287640f5b4eaade76f921bf9fd33b07075
Diffstat (limited to 'src/compiler/codegen/RallocUtil.cc')
| -rw-r--r-- | src/compiler/codegen/RallocUtil.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/codegen/RallocUtil.cc b/src/compiler/codegen/RallocUtil.cc index d5f6720071..afbefff437 100644 --- a/src/compiler/codegen/RallocUtil.cc +++ b/src/compiler/codegen/RallocUtil.cc @@ -1169,7 +1169,7 @@ extern void oatDoPromotion(CompilationUnit* cUnit) if (!(cUnit->disableOpt & (1 << kPromoteRegs))) { // Promote fpRegs - for (int i = 0; (fpRegs[i].count > 0) && (i < numRegs); i++) { + for (int i = 0; (i < numRegs) && (fpRegs[i].count > 0); i++) { DCHECK(validSreg(cUnit,fpRegs[i].sReg)); if (cUnit->promotionMap[fpRegs[i].sReg].fpLocation != kLocPhysReg) { int reg = oatAllocPreservedFPReg(cUnit, fpRegs[i].sReg, @@ -1181,7 +1181,7 @@ extern void oatDoPromotion(CompilationUnit* cUnit) } // Promote core regs - for (int i = 0; (coreRegs[i].count > 0) && i < numRegs; i++) { + for (int i = 0; (i < numRegs) && (coreRegs[i].count > 0); i++) { DCHECK(validSreg(cUnit,coreRegs[i].sReg)); if (cUnit->promotionMap[coreRegs[i].sReg].coreLocation != kLocPhysReg) { |