diff mbox

Fix PR63821

Message ID alpine.LSU.2.11.1411121104190.374@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Nov. 12, 2014, 10:05 a.m. UTC
This fixes a missing convert (oops) in the -(T)-X pattern.

Applied as obvious.

Richard.

2014-11-12  Richard Biener  <rguenther@suse.de>

	PR middle-end/63821
	* match.pd: Add missing conversion to the -(T)-X pattern.

	* gfortran.dg/pr63821.f90: New testcase.
diff mbox

Patch

Index: gcc/match.pd
===================================================================
--- gcc/match.pd	(revision 217349)
+++ gcc/match.pd	(working copy)
@@ -299,7 +299,7 @@  (define_predicates
   (if (tree_nop_conversion_p (type, TREE_TYPE (@1))
        && (TYPE_OVERFLOW_WRAPS (type)
 	   || (flag_sanitize & SANITIZE_SI_OVERFLOW) == 0))
-   @1))
+   (convert @1)))
 
  /* We can't reassociate floating-point or fixed-point plus or minus
     because of saturation to +-Inf.  */
Index: gcc/testsuite/gfortran.dg/pr63821.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr63821.f90	(revision 0)
+++ gcc/testsuite/gfortran.dg/pr63821.f90	(working copy)
@@ -0,0 +1,17 @@ 
+! { dg-do compile }
+! { dg-options "-O3" }
+SUBROUTINE calculates_green_opt()
+  INTEGER, PARAMETER :: dp=8
+  REAL(KIND=dp), ALLOCATABLE, DIMENSION(:) :: green, green1
+  ALLOCATE(green(-nrec:nrec),stat=i_all)
+  DO ikern=1,nrec
+     green(-ikern)=gleft+gright
+     IF (ABS(green(ikern)) <= 1.e-20_dp) THEN
+        nrec=ikern
+        EXIT
+     END IF
+  END DO
+  ALLOCATE(green1(-nrec:nrec),stat=i_all)
+  CALL scf_recursion(nrec,green(-nrec),green1(-nrec))
+END SUBROUTINE calculates_green_opt
+