summaryrefslogtreecommitdiffstats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2015-01-05 19:30:59 -0800
committerAndreas Gampe <agampe@google.com>2015-01-06 08:38:45 -0800
commitcfe71e59c667abb35bc2363c49af7f8b549c44d0 (patch)
tree85f4bcc5a3c4259ae1502ca035f6a00bedc36763 /compiler
parent3d5872eb090a04a9444b5621d381eec3846f47a3 (diff)
downloadandroid_art-cfe71e59c667abb35bc2363c49af7f8b549c44d0.tar.gz
android_art-cfe71e59c667abb35bc2363c49af7f8b549c44d0.tar.bz2
android_art-cfe71e59c667abb35bc2363c49af7f8b549c44d0.zip
ART: Fix divide-by-zero for ARM
There was an infinite loop in the code generation for a divide by literal zero. Bug: 18887754 Change-Id: Ibd481918d3c6d7bc62fdd1a6807042009f561d95
Diffstat (limited to 'compiler')
-rw-r--r--compiler/dex/quick/arm/int_arm.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/dex/quick/arm/int_arm.cc b/compiler/dex/quick/arm/int_arm.cc
index fe1d12610a..b1ed11cc61 100644
--- a/compiler/dex/quick/arm/int_arm.cc
+++ b/compiler/dex/quick/arm/int_arm.cc
@@ -567,6 +567,14 @@ bool ArmMir2Lir::SmallLiteralDivRem(Instruction::Code dalvik_opcode, bool is_div
// Try to convert *lit to 1 RegRegRegShift/RegRegShift form.
bool ArmMir2Lir::GetEasyMultiplyOp(int lit, ArmMir2Lir::EasyMultiplyOp* op) {
+ if (lit == 0) {
+ // Special case for *divide-by-zero*. The ops won't actually be used to generate code, as
+ // GenArithOpIntLit will directly generate exception-throwing code, and multiply-by-zero will
+ // have been optimized away earlier.
+ op->op = kOpInvalid;
+ return true;
+ }
+
if (IsPowerOfTwo(lit)) {
op->op = kOpLsl;
op->shift = LowestSetBit(lit);