diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2021-01-24 14:54:14 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2021-01-24 17:22:45 +0100 |
commit | 879b11da4ef9a675216eb1f3458cff1e53904c03 (patch) | |
tree | 3b0f52687a71d4ba4592a217d58366e5bf4c121d | |
parent | 56dbccf50c2185571f34c3dfaf4753942f6a2372 (diff) | |
download | sparse-879b11da4ef9a675216eb1f3458cff1e53904c03.tar.gz |
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 <luc.vanoostenryck@gmail.com>
-rw-r--r-- | simplify.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -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) |