From f355c3ff08710ac2eba3aac2aacc5e65caa06b4c Mon Sep 17 00:00:00 2001 From: Roland Levillain Date: Wed, 30 Mar 2016 19:09:03 +0100 Subject: Fix Boolean to integral types conversions. Bug: 27616343 Change-Id: I050f92045bca1b8b5d6da53547cc617f17be84b1 --- compiler/optimizing/graph_checker.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'compiler/optimizing/graph_checker.cc') diff --git a/compiler/optimizing/graph_checker.cc b/compiler/optimizing/graph_checker.cc index f2e77e28a6..c790d013b5 100644 --- a/compiler/optimizing/graph_checker.cc +++ b/compiler/optimizing/graph_checker.cc @@ -1005,4 +1005,19 @@ void GraphChecker::VisitBoundType(HBoundType* instruction) { } } +void GraphChecker::VisitTypeConversion(HTypeConversion* instruction) { + VisitInstruction(instruction); + Primitive::Type result_type = instruction->GetResultType(); + Primitive::Type input_type = instruction->GetInputType(); + // Invariant: We should never generate a conversion to a Boolean value. + if (result_type == Primitive::kPrimBoolean) { + AddError(StringPrintf( + "%s %d converts to a %s (from a %s).", + instruction->DebugName(), + instruction->GetId(), + Primitive::PrettyDescriptor(result_type), + Primitive::PrettyDescriptor(input_type))); + } +} + } // namespace art -- cgit v1.2.3-59-g8ed1b