diff options
author | Steven G. Kargl <kargl@gcc.gnu.org> | 2019-11-01 16:27:38 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2019-11-01 16:27:38 +0000 |
commit | c7e3443332f8c97305d401e1a35cd65a15ada235 (patch) | |
tree | 38c51290fc835a6be42b6ccef728fa852515d474 /gcc/fortran/decl.c | |
parent | 783aea334097f8cb6dba904128ce34708373af1c (diff) | |
download | gcc-c7e3443332f8c97305d401e1a35cd65a15ada235.zip gcc-c7e3443332f8c97305d401e1a35cd65a15ada235.tar.gz gcc-c7e3443332f8c97305d401e1a35cd65a15ada235.tar.bz2 |
re PR fortran/90988 (Wrong error message with variables named "PUBLIC*")
2019-11-01 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/90988
* decl.c (gfc_match_private, gfc_match_public): Fixed-form source code
does not require whitespace between PRIVATE (or PUBLIC) and an entity.
2019-11-01 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/90988
* gfortran.dg/pr90988_4.f: New test.
From-SVN: r277714
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r-- | gcc/fortran/decl.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 25a3967..652b578 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -9059,7 +9059,6 @@ match gfc_match_private (gfc_statement *st) { gfc_state_data *prev; - char c; if (gfc_match ("private") != MATCH_YES) return MATCH_NO; @@ -9083,10 +9082,14 @@ gfc_match_private (gfc_statement *st) return MATCH_YES; } - /* At this point, PRIVATE must be followed by whitespace or ::. */ - c = gfc_peek_ascii_char (); - if (!gfc_is_whitespace (c) && c != ':') - return MATCH_NO; + /* At this point in free-form source code, PRIVATE must be followed + by whitespace or ::. */ + if (gfc_current_form == FORM_FREE) + { + char c = gfc_peek_ascii_char (); + if (!gfc_is_whitespace (c) && c != ':') + return MATCH_NO; + } prev = gfc_state_stack->previous; if (gfc_current_state () != COMP_MODULE @@ -9108,8 +9111,6 @@ gfc_match_private (gfc_statement *st) match gfc_match_public (gfc_statement *st) { - char c; - if (gfc_match ("public") != MATCH_YES) return MATCH_NO; @@ -9127,10 +9128,14 @@ gfc_match_public (gfc_statement *st) return MATCH_YES; } - /* At this point, PUBLIC must be followed by whitespace or ::. */ - c = gfc_peek_ascii_char (); - if (!gfc_is_whitespace (c) && c != ':') - return MATCH_NO; + /* At this point in free-form source code, PUBLIC must be followed + by whitespace or ::. */ + if (gfc_current_form == FORM_FREE) + { + char c = gfc_peek_ascii_char (); + if (!gfc_is_whitespace (c) && c != ':') + return MATCH_NO; + } if (gfc_current_state () != COMP_MODULE) { |