From 879b11da4ef9a675216eb1f3458cff1e53904c03 Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Sun, 24 Jan 2021 14:54:14 +0100 Subject: fix possible circular definition with can_move_to() can_move_to() is used to test if it is safe for a given pseudo to be used by some instruction. This is done by checking that the pseudo is defined 'before' the instruction. This should, of course, reject the cases where the pseudo is defined by the instruction itself because it would create a circular definition. However, this special case was not checked. Fix this by adding the missing check. Signed-off-by: Luc Van Oostenryck --- simplify.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/simplify.c b/simplify.c index 1e764848..0bb66bed 100644 --- a/simplify.c +++ b/simplify.c @@ -1606,6 +1606,8 @@ static inline bool can_move_to(pseudo_t src, struct instruction *dst) return true; def = src->def; + if (dst == def) + return false; bbs = def->bb; bbd = dst->bb; if (bbs == bbd) -- cgit 1.2.3-korg