From: Ilya Leoshkevich Date: Wed, 6 Nov 2019 10:10:04 +0000 (+0000) Subject: S/390: Fix failing RTL check in s390_canonicalize_comparison X-Git-Tag: releases/gcc-9.3.0~422 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f06b51b0e29f14b3752daa90a899d99c15205813;p=thirdparty%2Fgcc.git S/390: Fix failing RTL check in s390_canonicalize_comparison 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 (*op0, 1) 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-11-06 Ilya Leoshkevich * config/s390/s390.c (s390_canonicalize_comparison): Use XEXP (*op0, 1) instead of XEXP (*op1, 0). gcc/testsuite/ChangeLog: 2019-11-06 Ilya Leoshkevich * gcc.target/s390/sigfpe-eh.c: New test. From-SVN: r277874 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4a24d37df06e..5690dd9566f1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-11-06 Ilya Leoshkevich + Backport from mainline + + * config/s390/s390.c (s390_canonicalize_comparison): Use XEXP + (*op0, 1) instead of XEXP (*op1, 0). + 2019-11-05 Segher Boessenkool Backport from trunk diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 081b67d8dab5..db3f94978ec3 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -1788,7 +1788,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/ChangeLog b/gcc/testsuite/ChangeLog index 7a0bedbfb309..b88ed2e8e91a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-11-06 Ilya Leoshkevich + + Backport from mainline + * gcc.target/s390/sigfpe-eh.c: New test. + 2019-11-05 Andreas Krebbel Backport from mainline 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 000000000000..52b0bf39d9e0 --- /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 (); +}