This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] S/390: Fix failing RTL check in s390_canonicalize_comparison
- From: Ilya Leoshkevich <iii at linux dot ibm dot com>
- To: krebbel at linux dot ibm dot com, gcc-patches at gcc dot gnu dot org
- Cc: Ilya Leoshkevich <iii at linux dot ibm dot com>
- Date: Mon, 2 Sep 2019 16:46:41 +0200
- Subject: [PATCH] S/390: Fix failing RTL check in s390_canonicalize_comparison
Bootstrap and regtest running on s390x-redhat-linux.
The new sigfpe-eh.c fails with
internal compiler error: RTL check: expected elt 0 type 'e' or 'u', have 'w' (rtx const_int)
This is most likely due to a typo: XEXP (*op1, 0) was used, when
XEXP (*op1, 0) was intended. This did not cause any user-visible
problems, because reversed_comparison_code_parts ignores the
respective argument, and the release compiler is built without RTL
checks.
gcc/ChangeLog:
2019-09-02 Ilya Leoshkevich <iii@linux.ibm.com>
* config/s390/s390.c (s390_canonicalize_comparison): Use XEXP
(*op0, 1) instead of XEXP (*op1, 0).
gcc/testsuite/ChangeLog:
2019-09-02 Ilya Leoshkevich <iii@linux.ibm.com>
* gcc.target/s390/sigfpe-eh.c: New test.
---
gcc/config/s390/s390.c | 2 +-
gcc/testsuite/gcc.target/s390/sigfpe-eh.c | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.target/s390/sigfpe-eh.c
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index fa17d7d5d08..24784266848 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -1783,7 +1783,7 @@ s390_canonicalize_comparison (int *code, rtx *op0, rtx *op1,
if (*code == EQ)
new_code = reversed_comparison_code_parts (GET_CODE (*op0),
XEXP (*op0, 0),
- XEXP (*op1, 0), NULL);
+ XEXP (*op0, 1), NULL);
else
new_code = GET_CODE (*op0);
diff --git a/gcc/testsuite/gcc.target/s390/sigfpe-eh.c b/gcc/testsuite/gcc.target/s390/sigfpe-eh.c
new file mode 100644
index 00000000000..52b0bf39d9e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/sigfpe-eh.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-march=z196 -O2 -fexceptions -fnon-call-exceptions" } */
+
+extern float f (void);
+extern float g (void);
+
+float h (float x, float y)
+{
+ return x < y ? f () : g ();
+}
--
2.21.0