re PR fortran/84134 (ICE: Floating point exception)
authorThomas Koenig <tkoenig@gcc.gnu.org>
Tue, 30 Jan 2018 22:35:34 +0000 (22:35 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Tue, 30 Jan 2018 22:35:34 +0000 (22:35 +0000)
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

gcc/fortran/ChangeLog
gcc/fortran/array.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/data_implied_do_2.f90 [new file with mode: 0644]

index 292abc159531117775f2132735d11aadb0cd178f..35894cda5d04b4377a898f476a525fc7ec0d755b 100644 (file)
@@ -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
index 22a5ddc59de50f7345e331e7138ddd19858c8627..ee13d92fc92e2b58ab127b359b340d41bc89643a 100644 (file)
@@ -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;
index 34a8de4a56c98ede548a3a0cf93a1815061a5932..e5dc2b934a4139c5e5e5b23f82fddcc8d6c6f9bd 100644 (file)
@@ -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 (file)
index 0000000..9767441
--- /dev/null
@@ -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