]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2009-04-28 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 28 Apr 2009 15:27:09 +0000 (15:27 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 28 Apr 2009 15:27:09 +0000 (15:27 +0000)
PR middle-end/39937
* fold-const.c (fold_binary): Use distribute_real_division only
on float types.

* gfortran.fortran-torture/compile/pr39937.f: New testcase.

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

gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.fortran-torture/compile/pr39937.f [new file with mode: 0644]

index 0381548873ea2caa36b77649a11d195a05f206b2..72766c4d85bcdbca82dd4c73a34bec312559d28c 100644 (file)
@@ -1,3 +1,9 @@
+2009-04-28  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/39937
+       * fold-const.c (fold_binary): Use distribute_real_division only
+       on float types.
+
 2009-04-28  Steve Ellcey  <sje@cup.hp.com>
 
        * config.gcc (hppa*64*-*-hpux11*): Set use_gcc_stdint and
index 2b8f7333182dcd31d28370672ff5f27df64c86a3..14b9f100b517281536c8e82bf54b209dd9cc3182 100644 (file)
@@ -10102,7 +10102,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
                }
            }
 
-          if (flag_unsafe_math_optimizations
+         if (flag_unsafe_math_optimizations
              && (TREE_CODE (arg0) == RDIV_EXPR || TREE_CODE (arg0) == MULT_EXPR)
              && (TREE_CODE (arg1) == RDIV_EXPR || TREE_CODE (arg1) == MULT_EXPR)
              && (tem = distribute_real_division (code, type, arg0, arg1)))
@@ -10542,7 +10542,8 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
            }
        }
 
-      if (flag_unsafe_math_optimizations
+      if (FLOAT_TYPE_P (type)
+         && flag_unsafe_math_optimizations
          && (TREE_CODE (arg0) == RDIV_EXPR || TREE_CODE (arg0) == MULT_EXPR)
          && (TREE_CODE (arg1) == RDIV_EXPR || TREE_CODE (arg1) == MULT_EXPR)
          && (tem = distribute_real_division (code, type, arg0, arg1)))
index 5d226524d07f83402c3800b546cdef6d142e7aaf..6c91769246125ad9c38c6b68a23f860d4504cac5 100644 (file)
@@ -1,3 +1,8 @@
+2009-04-28  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/39937
+       * gfortran.fortran-torture/compile/pr39937.f: New testcase.
+
 2009-04-28  H.J. Lu  <hongjiu.lu@intel.com>
 
        g++.dg/warn/pr35652.C: Removed.
diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/pr39937.f b/gcc/testsuite/gfortran.fortran-torture/compile/pr39937.f
new file mode 100644 (file)
index 0000000..5ead135
--- /dev/null
@@ -0,0 +1,28 @@
+      SUBROUTINE DTREVC( SIDE, HOWMNY, SELECT, N, T, LDT, VL, LDVL, VR,
+     $                   LDVR, MM, M, WORK, INFO )
+      DOUBLE PRECISION   T( LDT, * ), VL( LDVL, * ), VR( LDVR, * ),
+     $                   WORK( * )
+      DOUBLE PRECISION   X( 2, 2 )
+      CALL DLALN2( .FALSE., 1, 1, SMIN, ONE, T( J, J ),
+     $                            ZERO, X, 2, SCALE, XNORM, IERR )
+      CALL DSCAL( KI, SCALE, WORK( 1+N ), 1 )
+      DO 90 J = KI - 2, 1, -1
+      IF( J.GT.JNXT )
+     $               GO TO 90
+      JNXT = J - 1
+      IF( J.GT.1 ) THEN
+          IF( T( J, J-1 ).NE.ZERO ) THEN
+              IF( WORK( J ).GT.BIGNUM / XNORM ) THEN
+                  X( 1, 1 ) = X( 1, 1 ) / XNORM
+              END IF
+          END IF
+          CALL DLALN2( .FALSE., 2, 2, SMIN, ONE,
+     $                            T( J-1, J-1 ), LDT, ONE, ONE,
+     $                            XNORM, IERR )
+          CALL DAXPY( J-2, -X( 1, 1 ), T( 1, J-1 ), 1,
+     $                           WORK( 1+N ), 1 )
+          CALL DAXPY( J-2, -X( 2, 2 ), T( 1, J ), 1,
+     $                           WORK( 1+N2 ), 1 )
+      END IF
+   90          CONTINUE
+      END