All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix crash while testing between conditional & unconditional OP_BR
@ 2017-01-27 11:38 Luc Van Oostenryck
  0 siblings, 0 replies; only message in thread
From: Luc Van Oostenryck @ 2017-01-27 11:38 UTC (permalink / raw)
  To: linux-sparse; +Cc: sparse

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@gmail.com>
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@gmail.com>
---
 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;
 	}
-- 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-27 11:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-27 11:38 [PATCH] fix crash while testing between conditional & unconditional OP_BR Luc Van Oostenryck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.