diff mbox series

S/390: Fix failing RTL check in s390_canonicalize_comparison

Message ID 20190902144641.82659-1-iii@linux.ibm.com
State New
Headers show
Series S/390: Fix failing RTL check in s390_canonicalize_comparison | expand

Commit Message

Ilya Leoshkevich Sept. 2, 2019, 2:46 p.m. UTC
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

Comments

Andreas Krebbel Sept. 2, 2019, 3:10 p.m. UTC | #1
On 02.09.19 16:46, Ilya Leoshkevich wrote:
> 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.

Ok. Thanks!

Andreas
diff mbox series

Patch

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 ();
+}