From 0ff0dfbf18bc964cf71b64dc6f1f1298bea12d04 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tobias=20Schl=C3=BCter?= Date: Sat, 26 Jun 2004 13:48:55 +0200 Subject: [PATCH] Andrew Vaught 2004-06-25 Tobias Schlueter Andrew Vaught PR fortran/15190 * decl.c (gfc_match_type_spec), io.c (match_io), parse.c (decode_statement): Enforce required space in free-form. Co-Authored-By: Andrew Vaught From-SVN: r83708 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/decl.c | 9 +++++++++ gcc/fortran/io.c | 12 +++++++++++- gcc/fortran/parse.c | 8 ++++---- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a2bb02c019c..581c7fab1d9 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2004-06-25 Tobias Schlueter + Andrew Vaught + + PR fortran/15190 + * decl.c (gfc_match_type_spec), io.c (match_io), parse.c + (decode_statement): Enforce required space in free-form. + 2004-06-21 Richard Kenner * f95-lang.c (LANG_HOOKS_GIMPLE_BEFORE_INLINING): Deleted. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index c6b8073edd5..2790865025f 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -884,6 +884,7 @@ gfc_match_type_spec (gfc_typespec * ts, int kind_flag) char name[GFC_MAX_SYMBOL_LEN + 1]; gfc_symbol *sym; match m; + int c; gfc_clear_ts (ts); @@ -962,6 +963,14 @@ get_kind: if (kind_flag == 0) return MATCH_YES; + if (gfc_current_form == FORM_FREE) + { + c = gfc_peek_char(); + if (!gfc_is_whitespace(c) && c != '*' && c != '(' + && c != ':' && c != ',') + return MATCH_NO; + } + m = gfc_match_kind_spec (ts); if (m == MATCH_NO && ts->type != BT_CHARACTER) m = gfc_match_old_kind_spec (ts); diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index ee52c693245..048f6f851a9 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -2046,7 +2046,7 @@ match_io (io_kind k) gfc_code *io_code; gfc_symbol *sym; gfc_expr *expr; - int comma_flag; + int comma_flag, c; locus where; gfc_dt *dt; match m; @@ -2059,6 +2059,16 @@ match_io (io_kind k) if (k == M_WRITE) goto syntax; + if (gfc_current_form == FORM_FREE) + { + c = gfc_peek_char(); + if (c != ' ' && c != '*' && c != '\'' && c != '"') + { + m = MATCH_NO; + goto cleanup; + } + } + m = match_dt_format (dt); if (m == MATCH_ERROR) goto cleanup; diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index 8b8aa5af4a0..3983db71650 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -177,7 +177,7 @@ decode_statement (void) case 'b': match ("backspace", gfc_match_backspace, ST_BACKSPACE); - match ("block data", gfc_match_block_data, ST_BLOCK_DATA); + match ("block data% ", gfc_match_block_data, ST_BLOCK_DATA); break; case 'c': @@ -206,7 +206,7 @@ decode_statement (void) if (gfc_match_end (&st) == MATCH_YES) return st; - match ("entry", gfc_match_entry, ST_ENTRY); + match ("entry% ", gfc_match_entry, ST_ENTRY); match ("equivalence", gfc_match_equivalence, ST_EQUIVALENCE); match ("external", gfc_match_external, ST_ATTR_DECL); break; @@ -229,7 +229,7 @@ decode_statement (void) break; case 'm': - match ("module% procedure", gfc_match_modproc, ST_MODULE_PROC); + match ("module% procedure% ", gfc_match_modproc, ST_MODULE_PROC); match ("module", gfc_match_module, ST_MODULE); break; @@ -273,7 +273,7 @@ decode_statement (void) break; case 'u': - match ("use", gfc_match_use, ST_USE); + match ("use% ", gfc_match_use, ST_USE); break; case 'w': -- 2.30.2