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 | |
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')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/decl.c | 27 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr90988_4.f | 10 |
4 files changed, 37 insertions, 11 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index be8ae58..34d7a71 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +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 Tobias Burnus <tobias@codesourcery.com> * f95-lang.c (LANG_HOOKS_OMP_ARRAY_DATA): Set to gfc_omp_array_data. 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) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 57709cc..e7dec2e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-11-01 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/90988 + * gfortran.dg/pr90988_4.f: New test. + 2019-11-01 Martin Sebor <msebor@redhat.com> * gcc.dg/tree-ssa/builtin-sprintf-warn-3.c: Declare test functions diff --git a/gcc/testsuite/gfortran.dg/pr90988_4.f b/gcc/testsuite/gfortran.dg/pr90988_4.f new file mode 100644 index 0000000..3379b2e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr90988_4.f @@ -0,0 +1,10 @@ +c { dg-do compile } + module foo + implicit none + real a,b,c + integer i,j,k + public a,b + publicc + private i,j + privatek + end module foo |