OSDN Git Service

* loop.c (basic_induction_var): Don't call convert_modes if mode
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Mar 2002 07:41:45 +0000 (07:41 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Mar 2002 07:41:45 +0000 (07:41 +0000)
classes are different.

* gcc.c-torture/compile/20020309-2.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@50721 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/loop.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20020309-2.c [new file with mode: 0644]

index 39de91f..5bd8a31 100644 (file)
@@ -1,3 +1,8 @@
+2002-03-13  Jakub Jelinek  <jakub@redhat.com>
+
+       * loop.c (basic_induction_var): Don't call convert_modes if mode
+       classes are different.
+
 2002-03-12  Richard Henderson  <rth@redhat.com>
 
        PR optimization/5901
index 3108b03..6617608 100644 (file)
@@ -6214,10 +6214,11 @@ basic_induction_var (loop, x, mode, dest_reg, p, inc_val, mult_val, location)
     case CONST:
       /* convert_modes aborts if we try to convert to or from CCmode, so just
          exclude that case.  It is very unlikely that a condition code value
-        would be a useful iterator anyways.  */
+        would be a useful iterator anyways.  convert_modes aborts if we try to
+        convert a float mode to non-float or vice versa too.  */
       if (loop->level == 1
-         && GET_MODE_CLASS (mode) != MODE_CC
-         && GET_MODE_CLASS (GET_MODE (dest_reg)) != MODE_CC)
+         && GET_MODE_CLASS (mode) == GET_MODE_CLASS (GET_MODE (dest_reg))
+         && GET_MODE_CLASS (mode) != MODE_CC)
        {
          /* Possible bug here?  Perhaps we don't know the mode of X.  */
          *inc_val = convert_modes (GET_MODE (dest_reg), mode, x, 0);
index cde8e62..9d55220 100644 (file)
@@ -1,3 +1,7 @@
+2002-03-13  Jakub Jelinek  <jakub@redhat.com>
+
+       * gcc.c-torture/compile/20020309-2.c: New test.
+
 2002-03-12  Nathan Sidwell  <nathan@codesourcery.com>
 
        * g++.dg/other/access1.C: New test.
diff --git a/gcc/testsuite/gcc.c-torture/compile/20020309-2.c b/gcc/testsuite/gcc.c-torture/compile/20020309-2.c
new file mode 100644 (file)
index 0000000..77699e4
--- /dev/null
@@ -0,0 +1,16 @@
+/* This testcase ICEd on IA-32 at -O2, because loop was calling convert_modes
+   between a MODE_FLOAT and MODE_INT class modes.  */
+
+typedef union
+{
+  double d;
+  long long ll;
+} A;
+
+void
+foo (A x, A **y, A z)
+{
+  for (; *y; y++)
+    if (x.ll == 262 && (*y)->d == z.d)
+      break;
+}