[gcc/devel/ranger] arm: Fix ICE caused by arm_gen_dicompare_reg [PR94292]
Aldy Hernandez
aldyh@gcc.gnu.org
Wed Jun 17 19:56:35 GMT 2020
https://gcc.gnu.org/g:6e4cd3cd259af2b5e04986a3f2222528a4f9f762
commit 6e4cd3cd259af2b5e04986a3f2222528a4f9f762
Author: Jakub Jelinek <jakub@redhat.com>
Date: Wed Mar 25 19:06:45 2020 +0100
arm: Fix ICE caused by arm_gen_dicompare_reg [PR94292]
The following testcase ICEs, because arm_gen_dicompare_reg creates invalid
RTL which then propagates into DEBUG_INSNs and ICEs while handling them.
The problem is that this function emits
(insn 18 17 19 2 (set (reg:CC_DNE 100 cc)
(compare (ior:SI (ne:SI (subreg:SI (reg:DI 129) 0)
(subreg:SI (reg:DI 114 [ _2 ]) 0))
(ne:SI (subreg:SI (reg:DI 129) 4)
(subreg:SI (reg:DI 114 [ _2 ]) 4)))
(const_int 0 [0]))) "pr94292.c":7:11 325 {*cmp_ior}
(nil))
and the invalid thing is that the COMPARE has VOIDmode. Setting a
non-VOIDmode SET_DEST to VOIDmode SET_SRC is only valid if the SET_SRC is
CONST_INT/CONST_DOUBLE.
The following patch fixes it by giving the COMPARE the same mode as it gives
to the SET_DEST cc register.
2020-03-25 Jakub Jelinek <jakub@redhat.com>
PR target/94292
* config/arm/arm.c (arm_gen_dicompare_reg): Set mode of COMPARE to
mode rather than VOIDmode.
* gcc.dg/pr94292.c: New test.
Diff:
---
gcc/ChangeLog | 6 ++++++
gcc/config/arm/arm.c | 2 +-
gcc/testsuite/ChangeLog | 5 +++++
gcc/testsuite/gcc.dg/pr94292.c | 13 +++++++++++++
4 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f9ba7519f12..06b06ab68de 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2020-03-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/94292
+ * config/arm/arm.c (arm_gen_dicompare_reg): Set mode of COMPARE to
+ mode rather than VOIDmode.
+
2020-03-25 Martin Sebor <msebor@redhat.com>
PR middle-end/94004
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 9b799084d44..d5207e0d8f0 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -15763,7 +15763,7 @@ arm_gen_dicompare_reg (rtx_code code, rtx x, rtx y, rtx scratch)
cc_reg = gen_rtx_REG (mode, CC_REGNUM);
emit_insn (gen_rtx_SET (cc_reg,
- gen_rtx_COMPARE (VOIDmode, conjunction,
+ gen_rtx_COMPARE (mode, conjunction,
const0_rtx)));
return cc_reg;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 855edb686fb..fe8460c7664 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-03-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/94292
+ * gcc.dg/pr94292.c: New test.
+
2020-03-25 Martin Sebor <msebor@redhat.com>
PR middle-end/94004
diff --git a/gcc/testsuite/gcc.dg/pr94292.c b/gcc/testsuite/gcc.dg/pr94292.c
new file mode 100644
index 00000000000..dd2a29c066f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr94292.c
@@ -0,0 +1,13 @@
+/* PR target/94292 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -g -fno-tree-dce" } */
+
+unsigned short a;
+unsigned long long b;
+
+long long
+foo (int d)
+{
+ d >>= a != (unsigned long long) -a;
+ return a + b;
+}
More information about the Gcc-cvs
mailing list