https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85796
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
Keywords| |ice-on-invalid-code
--- Comment #2 from kargl at gcc dot gnu.org ---
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 280157)
+++ gcc/fortran/resolve.c (working copy)
@@ -16174,27 +16174,34 @@ traverse_data_list (gfc_data_variable *var, locus
*whe
end = gfc_copy_expr (var->iter.end);
step = gfc_copy_expr (var->iter.step);
- if (!gfc_simplify_expr (start, 1)
- || start->expr_type != EXPR_CONSTANT)
+ if (!gfc_simplify_expr (start, 1) || start->expr_type != EXPR_CONSTANT)
{
gfc_error ("start of implied-do loop at %L could not be "
"simplified to a constant value", &start->where);
retval = false;
goto cleanup;
}
- if (!gfc_simplify_expr (end, 1)
- || end->expr_type != EXPR_CONSTANT)
+
+ if (!gfc_simplify_expr (end, 1) || end->expr_type != EXPR_CONSTANT)
{
gfc_error ("end of implied-do loop at %L could not be "
"simplified to a constant value", &start->where);
retval = false;
goto cleanup;
}
- if (!gfc_simplify_expr (step, 1)
- || step->expr_type != EXPR_CONSTANT)
+
+ if (!gfc_simplify_expr (step, 1) || step->expr_type != EXPR_CONSTANT)
{
gfc_error ("step of implied-do loop at %L could not be "
- "simplified to a constant value", &start->where);
+ "simplified to a constant value", &step->where);
+ retval = false;
+ goto cleanup;
+ }
+
+ if (mpz_cmp_si (step->value.integer, 0) == 0)
+ {
+ gfc_error ("step of implied-do loop at %L shall not be zero",
+ &step->where);
retval = false;
goto cleanup;
}