find_flags_uses_in_insn used SET_SRC without first checking
for a SET.  This showed up as an RTL checking failure in
g++.dg/torture/pr90994.C on aarch64.

Tested on aarch64-linux-gnu & pushed as obvious.

Richard


gcc/
        * compare-elim.cc (find_flags_uses_in_insn): Guard use of SET_SRC.
---
 gcc/compare-elim.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/compare-elim.cc b/gcc/compare-elim.cc
index 5cbd2c027b1..c59dc0cf5a5 100644
--- a/gcc/compare-elim.cc
+++ b/gcc/compare-elim.cc
@@ -254,7 +254,8 @@ find_flags_uses_in_insn (struct comparison *cmp, rtx_insn 
*insn)
        x = PATTERN (insn);
        if (GET_CODE (x) == PARALLEL)
          x = XVECEXP (x, 0, 0);
-       x = SET_SRC (x);
+       if (GET_CODE (x) == SET)
+         x = SET_SRC (x);
        if (GET_CODE (x) == IF_THEN_ELSE)
          x = XEXP (x, 0);
        if (COMPARISON_P (x)
-- 
2.25.1

Reply via email to