diff options
Diffstat (limited to 'gcc/fortran/io.c')
-rw-r--r-- | gcc/fortran/io.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index bb64560..9ae06b1f 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -3657,7 +3657,17 @@ match_io_element (io_kind k, gfc_code **cpp) { m = gfc_match_variable (&expr, 0); if (m == MATCH_NO) - gfc_error ("Expected variable in READ statement at %C"); + { + gfc_error ("Expecting variable in READ statement at %C"); + m = MATCH_ERROR; + } + + if (m == MATCH_YES && expr->expr_type == EXPR_CONSTANT) + { + gfc_error ("Expecting variable or io-implied-do in READ statement " + "at %L", &expr->where); + m = MATCH_ERROR; + } if (m == MATCH_YES && expr->expr_type == EXPR_VARIABLE @@ -3667,7 +3677,6 @@ match_io_element (io_kind k, gfc_code **cpp) &expr->where); m = MATCH_ERROR; } - } else { |