Hello world,

another obvious fix, this time for an ice-on-invalid regression,
committed after regression-testing.

Regards

        Thomas

2017-01-30  Thomas Koenig  <tkoe...@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  <tkoe...@gcc.gnu.org>

        PR fortran/84134
Index: array.c
===================================================================
--- array.c	(Revision 257131)
+++ array.c	(Arbeitskopie)
@@ -2245,9 +2245,12 @@ gfc_ref_dimen_size (gfc_array_ref *ar, int dimen,
       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;
! { 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

Reply via email to