This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR fortran/77460


I plan to commit the following patch in the next day or two.
Objections?

2016-09-03  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/77460
	* simplify.c (simplify_transformation_to_scalar):  On error, result
	may be NULL, simply return.

2016-09-03  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/77460
	* gfortran.dg/pr77460.f90: New test.


Index: gcc/fortran/simplify.c
===================================================================
--- gcc/fortran/simplify.c	(revision 239797)
+++ gcc/fortran/simplify.c	(working copy)
@@ -489,6 +489,8 @@ simplify_transformation_to_scalar (gfc_e
 	}
 
       result = op (result, gfc_copy_expr (a));
+      if (!result)
+	return result;
     }
 
   return result;
Index: gcc/testsuite/gfortran.dg/pr77460.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr77460.f90	(nonexistent)
+++ gcc/testsuite/gfortran.dg/pr77460.f90	(working copy)
@@ -0,0 +1,7 @@
+! { dg-do compile }
+  double precision, parameter :: x = huge(1d0)
+  print*, sum((/x,-x/))
+  print*, sum((/x,x,-x,-x/))  ! { dg-error "overflow" }
+  print*, sum((/x,-x,1d0/))
+  print*, sum((/1d0,x,-x/))
+end

-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]