From: Steven G. Kargl Date: Sun, 4 Sep 2016 18:43:40 +0000 (+0000) Subject: re PR fortran/77460 (ICE when summing an overflowing array) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e85921ee9fd4e526517ec121eff8e8ea04e78b8b;p=gcc.git re PR fortran/77460 (ICE when summing an overflowing array) 2016-09-04 Steven G. Kargl PR fortran/77460 * simplify.c (simplify_transformation_to_scalar): On error, result may be NULL, simply return. 2016-09-04 Steven G. Kargl PR fortran/77460 * gfortran.dg/pr77460.f90: New test. From-SVN: r239979 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 9913c97de04..0b452f4664e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2016-09-04 Steven G. Kargl + + PR fortran/77460 + * simplify.c (simplify_transformation_to_scalar): On error, result + may be NULL, simply return. + 2016-08-31 Jakub Jelinek PR fortran/77352 diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 6e6566d9245..c396653fa1c 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -489,6 +489,8 @@ simplify_transformation_to_scalar (gfc_expr *result, gfc_expr *array, gfc_expr * } result = op (result, gfc_copy_expr (a)); + if (!result) + return result; } return result; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 64a7b4ade44..6f5c7878bd6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-09-04 Steven G. Kargl + + PR fortran/77460 + * gfortran.dg/pr77460.f90: New test. + 2016-09-03 Jakub Jelinek PR c/65467 diff --git a/gcc/testsuite/gfortran.dg/pr77460.f90 b/gcc/testsuite/gfortran.dg/pr77460.f90 new file mode 100644 index 00000000000..5e28a99c176 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr77460.f90 @@ -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