+2011-08-21 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/50130
+ * resolve.c (resolve_array_ref): Don't calculate upper bound
+ if the stride is zero.
+
2011-08-20 Janus Weil <janus@gcc.gnu.org>
PR fortran/49638
/* Fill in the upper bound, which may be lower than the
specified one for something like a(2:10:5), which is
identical to a(2:7:5). Only relevant for strides not equal
- to one. */
+ to one. Don't try a division by zero. */
if (ar->dimen_type[i] == DIMEN_RANGE
&& ar->stride[i] != NULL && ar->stride[i]->expr_type == EXPR_CONSTANT
- && mpz_cmp_si (ar->stride[i]->value.integer, 1L) != 0)
+ && mpz_cmp_si (ar->stride[i]->value.integer, 1L) != 0
+ && mpz_cmp_si (ar->stride[i]->value.integer, 0L) != 0)
{
mpz_t size, end;
--- /dev/null
+! { dg-do compile }
+! PR 50130 - this caused an ICE. Test case supplied by Joost
+! VandeVondele.
+integer, parameter :: a(10)=0
+integer, parameter :: b(10)=a(1:10:0) ! { dg-error "Illegal stride of zero" }
+END
+