aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/primary.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/primary.c')
-rw-r--r--gcc/fortran/primary.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index b97b4a1ca59..c0ab09e7f50 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -1247,8 +1247,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)