summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
author George Burgess IV <gbiv@google.com> 2017-06-22 15:47:25 -0700
committer George Burgess IV <gbiv@google.com> 2017-06-22 15:47:25 -0700
commita4b58ed1ef8dceafbffcfa88bf2c11144e302d18 (patch)
treec1a931ba1bc1c710d1cdad9291c57aaa6b373597 /compiler
parentb96ed2c271a56fb8be0c8f30231710095e66a201 (diff)
Fix static analyzer warning
nodes.cc: warning: Access to field 'next_' results in a dereference of a null pointer (loaded from field 'last_instruction_') This was split from https://android-review.googlesource.com/#/c/416101/. Please see the discussion nodes.cc (patch set 1) for why this warning is triggered. Bug: 32619234 Test: test-art-host. Rebuilt ART with the analyzer to verify that these issues are gone. Change-Id: Id5da00ceee0667441233153a7971d238ea8c8650
Diffstat (limited to 'compiler')
-rw-r--r--compiler/optimizing/nodes.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index d0047c54f2..4ca833707b 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -967,6 +967,7 @@ void HInstructionList::AddInstruction(HInstruction* instruction) {
DCHECK(last_instruction_ == nullptr);
first_instruction_ = last_instruction_ = instruction;
} else {
+ DCHECK(last_instruction_ != nullptr);
last_instruction_->next_ = instruction;
instruction->previous_ = last_instruction_;
last_instruction_ = instruction;