Commit 2d27cb44 by Thomas Koenig

re PR fortran/50130 (ICE with invalid array slice)

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-21  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/50130
	* gfortran.dg/zero_stride_1.f90:  New test.

From-SVN: r177940
parent 51935358
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
......
......@@ -4569,10 +4569,11 @@ resolve_array_ref (gfc_array_ref *ar)
/* 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;
......
2011-08-21 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/50130
* gfortran.dg/zero_stride_1.f90: New test.
2011-08-20 Janus Weil <janus@gcc.gnu.org>
PR fortran/49638
......
! { 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment