summaryrefslogtreecommitdiff
path: root/compiler/optimizing/instruction_builder.cc
diff options
context:
space:
mode:
authorGeorge Burgess IV <gbiv@google.com>2017-05-23 15:36:41 -0700
committerGeorge Burgess IV <gbiv@google.com>2017-05-23 15:42:07 -0700
commitf20729914d87ab30e6c96420720d8718affd587f (patch)
treed86efb150d9493c97cee50c2c2e9137ec7e4b309 /compiler/optimizing/instruction_builder.cc
parent14538fb50832ac20445af5a92003bc250f486c22 (diff)
optimizing: Fix a potential nullptr dereference
Operator precedence in C++ means the DCHECK was parsed as DCHECK((allocation != nullptr && allocation->IsNewInstance()) || allocation->IsNewArray()) Caught by the static analyzer: art/compiler/optimizing/instruction_builder.cc:1004:14: warning: Called C++ object pointer is null [clang-analyzer-core.CallAndMessage] Bug: None Test: Reran the static analyzer. No more nullptr complaints. m builds the file fine, as well. Change-Id: Iad94719fc013f1883746128e066452994740f171
Diffstat (limited to 'compiler/optimizing/instruction_builder.cc')
-rw-r--r--compiler/optimizing/instruction_builder.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc
index 40fafb0ae5..df9e7164ed 100644
--- a/compiler/optimizing/instruction_builder.cc
+++ b/compiler/optimizing/instruction_builder.cc
@@ -1000,8 +1000,8 @@ HNewInstance* HInstructionBuilder::BuildNewInstance(dex::TypeIndex type_index, u
void HInstructionBuilder::BuildConstructorFenceForAllocation(HInstruction* allocation) {
DCHECK(allocation != nullptr &&
- allocation->IsNewInstance() ||
- allocation->IsNewArray()); // corresponding to "new" keyword in JLS.
+ (allocation->IsNewInstance() ||
+ allocation->IsNewArray())); // corresponding to "new" keyword in JLS.
if (allocation->IsNewInstance()) {
// STRING SPECIAL HANDLING: