diff options
| -rw-r--r-- | compiler/dex/verified_method.cc | 4 | ||||
| -rw-r--r-- | runtime/verifier/reg_type-inl.h | 3 | ||||
| -rw-r--r-- | test/801-VoidCheckCast/classes.dex | bin | 0 -> 660 bytes | |||
| -rw-r--r-- | test/801-VoidCheckCast/expected.txt | 0 | ||||
| -rw-r--r-- | test/801-VoidCheckCast/info.txt | 4 | ||||
| -rwxr-xr-x | test/etc/default-build | 5 |
6 files changed, 16 insertions, 0 deletions
diff --git a/compiler/dex/verified_method.cc b/compiler/dex/verified_method.cc index 9f0a696096..17328c4a5b 100644 --- a/compiler/dex/verified_method.cc +++ b/compiler/dex/verified_method.cc @@ -282,6 +282,10 @@ void VerifiedMethod::GenerateSafeCastSet(verifier::MethodVerifier* method_verifi Instruction::Code code = inst->Opcode(); if ((code == Instruction::CHECK_CAST) || (code == Instruction::APUT_OBJECT)) { uint32_t dex_pc = inst->GetDexPc(code_item->insns_); + if (!method_verifier->GetInstructionFlags(dex_pc).IsVisited()) { + // Do not attempt to quicken this instruction, it's unreachable anyway. + continue; + } const verifier::RegisterLine* line = method_verifier->GetRegLine(dex_pc); bool is_safe_cast = false; if (code == Instruction::CHECK_CAST) { diff --git a/runtime/verifier/reg_type-inl.h b/runtime/verifier/reg_type-inl.h index 480ed40ba8..f445132df5 100644 --- a/runtime/verifier/reg_type-inl.h +++ b/runtime/verifier/reg_type-inl.h @@ -81,6 +81,9 @@ inline bool RegType::AssignableFrom(const RegType& lhs, const RegType& rhs, bool return rhs.IsLongTypes(); } else if (lhs.IsDoubleLo()) { return rhs.IsDoubleTypes(); + } else if (lhs.IsConflict()) { + LOG(WARNING) << "RegType::AssignableFrom lhs is Conflict!"; + return false; } else { CHECK(lhs.IsReferenceTypes()) << "Unexpected register type in IsAssignableFrom: '" diff --git a/test/801-VoidCheckCast/classes.dex b/test/801-VoidCheckCast/classes.dex Binary files differnew file mode 100644 index 0000000000..e6f0f02967 --- /dev/null +++ b/test/801-VoidCheckCast/classes.dex diff --git a/test/801-VoidCheckCast/expected.txt b/test/801-VoidCheckCast/expected.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/801-VoidCheckCast/expected.txt diff --git a/test/801-VoidCheckCast/info.txt b/test/801-VoidCheckCast/info.txt new file mode 100644 index 0000000000..422f740715 --- /dev/null +++ b/test/801-VoidCheckCast/info.txt @@ -0,0 +1,4 @@ +A test that is only available as a DEX binary. + +This tests that an attempt to use check-cast with the void type doesn't +cause the compiler to crash. diff --git a/test/etc/default-build b/test/etc/default-build index ab859ec9f4..6731ad31b7 100755 --- a/test/etc/default-build +++ b/test/etc/default-build @@ -17,6 +17,11 @@ # Stop if something fails. set -e +if [ -e classes.dex ]; then + zip $TEST_NAME.jar classes.dex + exit 0 +fi + mkdir classes ${JAVAC} -d classes `find src -name '*.java'` |