diff options
author | Steven G. Kargl <kargl@gcc.gnu.org> | 2018-03-06 19:05:48 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2018-03-06 19:05:48 +0000 |
commit | 284ee475e1c239b9d74bd2c5fc7dde457c9db4f7 (patch) | |
tree | e7ee124f6dfec76895093567e821277038a6f4dc /gcc/fortran/primary.c | |
parent | 2128896318a0e71a002566d2150a54dd6a44765d (diff) | |
download | gcc-284ee475e1c239b9d74bd2c5fc7dde457c9db4f7.zip gcc-284ee475e1c239b9d74bd2c5fc7dde457c9db4f7.tar.gz gcc-284ee475e1c239b9d74bd2c5fc7dde457c9db4f7.tar.bz2 |
re PR fortran/56667 (Syntax error causes misleading message: "Expected PARAMETER symbol in complex constant")
2018-03-06 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/56667
* primary.c (match_sym_complex_part): Give the matcher for an implied
do-loop a chance to run.
2018-03-06 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/56667
* gfortran.dg/implied_do_2.f90: New test.
* gfortran.dg/coarray_8.f90: Update for new error message.
From-SVN: r258281
Diffstat (limited to 'gcc/fortran/primary.c')
-rw-r--r-- | gcc/fortran/primary.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index d889ed1..702010a 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -1248,8 +1248,22 @@ match_sym_complex_part (gfc_expr **result) if (sym->attr.flavor != FL_PARAMETER) { - gfc_error ("Expected PARAMETER symbol in complex constant at %C"); - return MATCH_ERROR; + /* Give the matcher for implied do-loops a chance to run. This yields + a much saner error message for "write(*,*) (i, i=1, 6" where the + right parenthesis is missing. */ + char c; + gfc_gobble_whitespace (); + c = gfc_peek_ascii_char (); + if (c == '=' || c == ',') + { + m = MATCH_NO; + } + else + { + gfc_error ("Expected PARAMETER symbol in complex constant at %C"); + m = MATCH_ERROR; + } + return m; } if (!sym->value) |