This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] PR fortran/77460
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Fri, 2 Sep 2016 13:16:01 -0700
- Subject: [PATCH] PR fortran/77460
- Authentication-results: sourceware.org; auth=none
- Reply-to: kargl at uw dot edu
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