From 9143aa524cee23faf8d4f11d0a8a7b5393952406 Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Fri, 25 May 2018 08:09:10 +0200 Subject: [PATCH] re PR fortran/85839 ([F2018] warn for obsolescent features) 2018-05-25 Janus Weil PR fortran/85839 * match.c (gfc_match_block_data): Call gfc_notify_std to warn about an obsolescent feature in Fortran 2018. (gfc_match_equivalence): Ditto. * resolve.c (resolve_common_blocks): Ditto. (gfc_resolve_forall): Ditto. * symbol.c (gfc_define_st_label): Ditto. 2018-05-25 Janus Weil PR fortran/85839 * gfortran.dg/f2018_obs.f90: New test case. From-SVN: r260705 --- gcc/fortran/ChangeLog | 10 +++++++++ gcc/fortran/match.c | 7 ++++++ gcc/fortran/resolve.c | 7 ++++++ gcc/fortran/symbol.c | 4 ++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/f2018_obs.f90 | 29 +++++++++++++++++++++++++ 6 files changed, 62 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/f2018_obs.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 98fbfd1d50a..63d42976676 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,13 @@ +2018-05-25 Janus Weil + + PR fortran/85839 + * match.c (gfc_match_block_data): Call gfc_notify_std to warn about + an obsolescent feature in Fortran 2018. + (gfc_match_equivalence): Ditto. + * resolve.c (resolve_common_blocks): Ditto. + (gfc_resolve_forall): Ditto. + * symbol.c (gfc_define_st_label): Ditto. + 2018-05-24 Steven G. Kargl PR fortran/85543 diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index 8379ff57944..1ab0e0fad9a 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -5259,6 +5259,10 @@ gfc_match_block_data (void) gfc_symbol *sym; match m; + if (!gfc_notify_std (GFC_STD_F2018_OBS, "BLOCK DATA construct at %L", + &gfc_current_locus)) + return MATCH_ERROR; + if (gfc_match_eos () == MATCH_YES) { gfc_new_block = NULL; @@ -5575,6 +5579,9 @@ gfc_match_equivalence (void) } } + if (!gfc_notify_std (GFC_STD_F2018_OBS, "EQUIVALENCE statement at %C")) + return MATCH_ERROR; + return MATCH_YES; syntax: diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 43b1dedd2b2..3a0ff80ab89 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -997,6 +997,10 @@ resolve_common_blocks (gfc_symtree *common_root) resolve_common_vars (common_root->n.common, true); + if (!gfc_notify_std (GFC_STD_F2018_OBS, "COMMON block at %L", + &common_root->n.common->where)) + return; + /* The common name is a global name - in Fortran 2003 also if it has a C binding name, since Fortran 2008 only the C binding name is a global identifier. */ @@ -9930,6 +9934,9 @@ gfc_resolve_forall (gfc_code *code, gfc_namespace *ns, int forall_save) old_nvar = nvar; + if (!gfc_notify_std (GFC_STD_F2018_OBS, "FORALL construct at %L", &code->loc)) + return; + /* Start to resolve a FORALL construct */ if (forall_save == 0) { diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index 5538763732a..4f060633da1 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -2725,6 +2725,10 @@ gfc_define_st_label (gfc_st_label *lp, gfc_sl_type type, locus *label_locus) "DO termination statement which is not END DO" " or CONTINUE with label %d at %C", labelno)) return; + if (type == ST_LABEL_DO_TARGET + && !gfc_notify_std (GFC_STD_F2018_OBS, "Labeled DO statement " + "at %L", label_locus)) + return; break; default: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bdf5e846b09..59b230956e8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-05-25 Janus Weil + + PR fortran/85839 + * gfortran.dg/f2018_obs.f90: New test case. + 2018-05-24 Steven G. Kargl PR fortran/85543 diff --git a/gcc/testsuite/gfortran.dg/f2018_obs.f90 b/gcc/testsuite/gfortran.dg/f2018_obs.f90 new file mode 100644 index 00000000000..0a8dca9706a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/f2018_obs.f90 @@ -0,0 +1,29 @@ +! { dg-do compile } +! { dg-options "-std=f2018" } +! +! PR 85839: [F2018] warn for obsolescent features +! +! Contributed by Janus Weil + +block data ! { dg-warning "obsolescent feature" } + common /a/ y(3) ! { dg-warning "obsolescent feature" } + data y /3*1./ +end + +program f2018_obs + + implicit none + integer :: a(10),b(10),j(8),i + real :: x(3) + common /c/ x ! { dg-warning "obsolescent feature" } + + equivalence (a(10),b(1)) ! { dg-warning "obsolescent feature" } + + do 99 i=1,10 +99 continue ! { dg-warning "obsolescent feature" } + + j = (/ 0, 1, 2, 3, 4, 0, 6, 7 /) + forall (i=1:8, j(i) /= 0) ! { dg-warning "obsolescent feature" } + j(i) = 0 + end forall +end -- 2.30.2