aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-03-25 23:17:40 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-05-06 01:37:01 +0200
commit0f04287d49a9a812064e11f000c6eb51ba417f01 (patch)
treedac2fee86e4ae87e614708c6b863fb79e7d63536
parent26688ccf9a4d3b93ce3af58578655b18896226fe (diff)
downloadsparse-dev-0f04287d49a9a812064e11f000c6eb51ba417f01.tar.gz
fix missing checks for deleted instructions
Instructions with a null ->bb are instructions which have been killed. As such, they must thus always be ignored. Fix this by adding the missing checks for null ->bb when looping over all the instructions of a basic block. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--graph.c2
-rw-r--r--sparse.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/graph.c b/graph.c
index c9af9a58..a24c6e17 100644
--- a/graph.c
+++ b/graph.c
@@ -74,6 +74,8 @@ static void graph_ep(struct entrypoint *ep)
/* List loads and stores */
FOR_EACH_PTR(bb->insns, insn) {
+ if (!insn->bb)
+ continue;
switch(insn->opcode) {
case OP_STORE:
if (insn->symbol->type == PSEUDO_SYM) {
diff --git a/sparse.c b/sparse.c
index ef5ee476..9d1cdc51 100644
--- a/sparse.c
+++ b/sparse.c
@@ -47,6 +47,8 @@ static int context_increase(struct basic_block *bb, int entry)
FOR_EACH_PTR(bb->insns, insn) {
int val;
+ if (!insn->bb)
+ continue;
if (insn->opcode != OP_CONTEXT)
continue;
val = insn->increment;