aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2018-01-30 22:35:34 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2018-01-30 22:35:34 +0000
commit8fb2cc6b24b32595ad1e50ef38a3847799574290 (patch)
tree04378266045fd4570ebf4987fcb9b36b0ab2ae3d
parentf58d41ff24cd35c9a351c2d805c869552576baae (diff)
downloadgcc-8fb2cc6b24b32595ad1e50ef38a3847799574290.zip
gcc-8fb2cc6b24b32595ad1e50ef38a3847799574290.tar.gz
gcc-8fb2cc6b24b32595ad1e50ef38a3847799574290.tar.bz2
re PR fortran/84134 (ICE: Floating point exception)
2017-01-30 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/84134 * array.c (gfc_ref_dimen_size): Whitespace fixes. If stride is zero, return false. 2017-01-30 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/84134 * gfortran.dg/data_implied_do_2.f90: New test. From-SVN: r257211
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/array.c5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/data_implied_do_2.f908
4 files changed, 23 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 292abc1..35894cd 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2017-01-30 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/84134
+ * array.c (gfc_ref_dimen_size): Whitespace fixes. If stride is
+ zero, return false.
+
2018-01-30 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/84133
diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
index 22a5ddc..ee13d92 100644
--- a/gcc/fortran/array.c
+++ b/gcc/fortran/array.c
@@ -2245,9 +2245,12 @@ gfc_ref_dimen_size (gfc_array_ref *ar, int dimen, mpz_t *result, mpz_t *end)
else
{
stride_expr = gfc_copy_expr(ar->stride[dimen]);
+
if(!gfc_simplify_expr(stride_expr, 1))
gfc_internal_error("Simplification error");
- if (stride_expr->expr_type != EXPR_CONSTANT)
+
+ if (stride_expr->expr_type != EXPR_CONSTANT
+ || mpz_cmp_ui (stride_expr->value.integer, 0) == 0)
{
mpz_clear (stride);
return false;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 34a8de4..e5dc2b9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-01-30 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/84134
+ * gfortran.dg/data_implied_do_2.f90: New test.
+
2018-01-30 Janus Weil <janus@gcc.gnu.org>
* gfortran.dg/pr68318_1.f90: Add closing bracket in dejagnu directive.
diff --git a/gcc/testsuite/gfortran.dg/data_implied_do_2.f90 b/gcc/testsuite/gfortran.dg/data_implied_do_2.f90
new file mode 100644
index 0000000..9767441
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/data_implied_do_2.f90
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/84134 - this used to ICE.
+! Test case by Gerhard Steinmetz
+
+program p
+ integer :: i, x(3)
+ data (x(i+1:i+2:i),i=0,1) /1,2,3/ ! { dg-error "Nonconstant array section" }
+end