re PR middle-end/18520 (ICE in emit_store_flag, at expmed.c:5081with -ffast-math)
authorRoger Sayle <roger@eyesopen.com>
Mon, 22 Nov 2004 02:13:14 +0000 (02:13 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Mon, 22 Nov 2004 02:13:14 +0000 (02:13 +0000)
PR middle-end/18520
* dojump.c (compare_from_rtx): Clarify mode argument in function
description.  Correct order of mode/cmp_mode arguments in call to
simplify_relational_operation.  Check "tem" for COMPARISON_P.

* gcc.dg/pr18520-1.c: New test case.

From-SVN: r90997

gcc/ChangeLog
gcc/dojump.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr18520-1.c [new file with mode: 0644]

index e50939b..28c9d08 100644 (file)
@@ -1,3 +1,10 @@
+2004-11-21  Roger Sayle  <roger@eyesopen.com>
+
+       PR middle-end/18520
+       * dojump.c (compare_from_rtx): Clarify mode argument in function
+       description.  Correct order of mode/cmp_mode arguments in call to
+       simplify_relational_operation.  Check "tem" for COMPARISON_P.
+
 2004-11-21  David Edelsohn  <edelsohn@gnu.org>
 
        PR target/17836
index e506684..bcb575c 100644 (file)
@@ -689,9 +689,10 @@ do_jump_by_parts_equality_rtx (rtx op0, rtx if_false_label, rtx if_true_label)
 }
 \f
 /* Generate code for a comparison of OP0 and OP1 with rtx code CODE.
-   (including code to compute the values to be compared)
-   and set (CC0) according to the result.
-   The decision as to signed or unsigned comparison must be made by the caller.
+   MODE is the machine mode of the comparison, not of the result.
+   (including code to compute the values to be compared) and set CC0
+   according to the result.  The decision as to signed or unsigned
+   comparison must be made by the caller.
 
    We force a stack adjustment unless there are currently
    things pushed on the stack that aren't yet used.
@@ -725,17 +726,21 @@ compare_from_rtx (rtx op0, rtx op1, enum rtx_code code, int unsignedp,
   do_pending_stack_adjust ();
 
   code = unsignedp ? unsigned_condition (code) : code;
-  if (0 != (tem = simplify_relational_operation (code, mode, VOIDmode,
-                                                op0, op1)))
+  tem = simplify_relational_operation (code, VOIDmode, mode, op0, op1);
+  if (tem)
     {
       if (CONSTANT_P (tem))
        return tem;
 
-      code = GET_CODE (tem);
-      mode = GET_MODE (tem);
-      op0 = XEXP (tem, 0);
-      op1 = XEXP (tem, 1);
-      unsignedp = (code == GTU || code == LTU || code == GEU || code == LEU);
+      if (COMPARISON_P (tem))
+       {
+         code = GET_CODE (tem);
+         op0 = XEXP (tem, 0);
+         op1 = XEXP (tem, 1);
+         mode = GET_MODE (op0);
+         unsignedp = (code == GTU || code == LTU
+                      || code == GEU || code == LEU);
+       }
     }
 
   emit_cmp_insn (op0, op1, code, size, mode, unsignedp);
index ef3ca31..b9ec394 100644 (file)
@@ -1,3 +1,8 @@
+2004-11-21  Roger Sayle  <roger@eyesopen.com>
+
+       PR middle-end/18520
+       * gcc.dg/pr18520-1.c: New test case.
+
 2004-11-20  Joseph S. Myers  <joseph@codesourcery.com>
 
        * gcc.dg/Wchar-subscripts-1.c, gcc.dg/array-8.c: New tests.
diff --git a/gcc/testsuite/gcc.dg/pr18520-1.c b/gcc/testsuite/gcc.dg/pr18520-1.c
new file mode 100644 (file)
index 0000000..872d3a9
--- /dev/null
@@ -0,0 +1,11 @@
+/* PR middle-end/18520 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math" } */
+
+extern int isnan (double __value) __attribute__ ((__const__));
+
+int gsl_isnan (const double x)
+{
+  return isnan(x);
+}
+