This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR middle-end/52140, ICE on valid code
- From: Peter Bergner <bergner at vnet dot ibm dot com>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 08 Feb 2012 20:34:34 -0600
- Subject: [PATCH] Fix PR middle-end/52140, ICE on valid code
The following patch fixes an ICE when we try and generate a compare of
decimal float variables when we are not compiling for a cpu with dfp
hardware support. This is a regression from gcc 4.4. The patch below
bootstrapped and regression tested with no regressions on trunk, 4.6
and 4.5. Is this ok everywhere?
I'll note that there seem to be a few other places that need this change,
but they aren't needed to fix this ICE, so I left them for a 4.8. cleanup.
Peter
gcc/
PR middle-end/52140
* dojump.c (do_compare_rtx_and_jump): Use SCALAR_FLOAT_MODE_P.
gcc/testsuite/
PR middle-end/52140
* gcc.dg/dfp/pr52140.c: New test.
Index: gcc/dojump.c
===================================================================
--- gcc/dojump.c (revision 184032)
+++ gcc/dojump.c (working copy)
@@ -1049,7 +1049,7 @@ do_compare_rtx_and_jump (rtx op0, rtx op
}
else
{
- if (GET_MODE_CLASS (mode) == MODE_FLOAT
+ if (SCALAR_FLOAT_MODE_P (mode)
&& ! can_compare_p (code, mode, ccp_jump)
&& can_compare_p (swap_condition (code), mode, ccp_jump))
{
@@ -1060,7 +1060,7 @@ do_compare_rtx_and_jump (rtx op0, rtx op
op1 = tmp;
}
- else if (GET_MODE_CLASS (mode) == MODE_FLOAT
+ else if (SCALAR_FLOAT_MODE_P (mode)
&& ! can_compare_p (code, mode, ccp_jump)
/* Never split ORDERED and UNORDERED. These must be implemented. */
Index: gcc/testsuite/gcc.dg/dfp/pr52140.c
===================================================================
--- gcc/testsuite/gcc.dg/dfp/pr52140.c (revision 0)
+++ gcc/testsuite/gcc.dg/dfp/pr52140.c (revision 0)
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+/* This used to result in an ICE. */
+
+int
+foo (_Decimal64 x, _Decimal64 y)
+{
+ return (x < y) || (x > y);
+}