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

2016-09-03  Steven G. Kargl  <ka...@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  <ka...@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

Reply via email to