[PATCH] fix possible circular definition with can_move_to()

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

 



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 <luc.vanoostenryck@xxxxxxxxx>
---
 simplify.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/simplify.c b/simplify.c
index 1e7648486c49..0bb66bedf463 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)
-- 
2.30.0




[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