[PATCH] fix crash while testing between conditional & unconditional OP_BR

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



While testing the newly updated sparse-next I saw that a patch of mine
(3eadf3e6a "kill uses of replaced instructions") triggered an old
hidden bug.

To preserve bissectability the following patch should be applied
somewhere before the triggering one (but it will produce a small
conflict later with (dae3a1022 "cleanup kill_instruction()")
where the offending if-statement will need to be inversed.


>From 8d8416cf4057627fea13ca74b2c8c7a3e3448e0e Mon Sep 17 00:00:00 2001
From: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
Date: Fri, 27 Jan 2017 11:03:32 +0100
Subject: [PATCH] fix crash while testing between conditional & unconditional OP_BR

It seems that testing for a NULL insn->cond is not the right test,
what must be done is to test if either of ->bb_{true,false} is NULL.

Fixes: 556dbc8d75 ("Update usage chain for dead instructions")
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 simplify.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/simplify.c b/simplify.c
index b5cd0ea77..3dea03b5e 100644
--- a/simplify.c
+++ b/simplify.c
@@ -221,7 +221,7 @@ void kill_instruction(struct instruction *insn)
 	case OP_BR:
 		insn->bb = NULL;
 		repeat_phase |= REPEAT_CSE;
-		if (insn->cond)
+		if (insn->bb_true && insn->bb_false)
 			kill_use(&insn->cond);
 		return;
 	}
-- 
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux