+2010-05-22 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/43851
+ * match.c (gfc_match_stopcode): Use gfc_match_init_expr. Go to cleanup
+ before returning MATCH_ERROR. Add check for scalar. Add check for
+ default integer kind.
+
2010-05-22 Janus Weil <janus@gcc.gnu.org>
PR fortran/44212
if (gfc_match_eos () != MATCH_YES)
{
- m = gfc_match_expr (&e);
+ m = gfc_match_init_expr (&e);
if (m == MATCH_ERROR)
goto cleanup;
if (m == MATCH_NO)
if (st == ST_STOP && gfc_find_state (COMP_CRITICAL) == SUCCESS)
{
gfc_error ("Image control statement STOP at %C in CRITICAL block");
- return MATCH_ERROR;
+ goto cleanup;
}
if (e != NULL)
{
gfc_error ("STOP code at %L must be either INTEGER or CHARACTER type",
&e->where);
- return MATCH_ERROR;
+ goto cleanup;
+ }
+
+ if (e->rank != 0)
+ {
+ gfc_error ("STOP code at %L must be scalar",
+ &e->where);
+ goto cleanup;
}
if (e->ts.type == BT_CHARACTER
{
gfc_error ("STOP code at %L must be default character KIND=%d",
&e->where, (int) gfc_default_character_kind);
- return MATCH_ERROR;
+ goto cleanup;
}
- if (e->expr_type != EXPR_CONSTANT)
+ if (e->ts.type == BT_INTEGER
+ && e->ts.kind != gfc_default_integer_kind)
{
- gfc_error ("STOP code at %L must be a constant expression",
- &e->where);
- return MATCH_ERROR;
+ gfc_error ("STOP code at %L must be default integer KIND=%d",
+ &e->where, (int) gfc_default_integer_kind);
+ goto cleanup;
}
}