From: Harald Anlauf Date: Thu, 14 Feb 2019 20:24:54 +0000 (+0000) Subject: re PR fortran/88248 ([F18] Bogus warning about obsolescent feature: Labeled DO statement) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=14b693baa2ae60ab39944c58b5a0a898df616038;p=gcc.git re PR fortran/88248 ([F18] Bogus warning about obsolescent feature: Labeled DO statement) 2019-02-14 Harald Anlauf PR fortran/88248 * symbol.c: Move check for labeled DO statement from gfc_define_st_label to gfc_reference_st_label. PR fortran/88248 * gfortran.dg/pr88248.f90: New test. * gfortran.dg/f2018_obs.f90: Updated test. From-SVN: r268895 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 71cef4f1884..bcf885e729d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2019-02-14 Harald Anlauf + + PR fortran/88248 + * symbol.c: Move check for labeled DO statement from + gfc_define_st_label to gfc_reference_st_label. + 2019-02-14 Cesar Philippidis PR fortran/72715 diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index b7408ac3f21..c8a1f842d35 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -2743,10 +2743,6 @@ 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: @@ -2804,6 +2800,11 @@ gfc_reference_st_label (gfc_st_label *lp, gfc_sl_type type) "Shared DO termination label %d at %C", labelno)) return false; + if (type == ST_LABEL_DO_TARGET + && !gfc_notify_std (GFC_STD_F2018_OBS, "Labeled DO statement " + "at %L", &gfc_current_locus)) + return false; + if (lp->referenced != ST_LABEL_DO_TARGET) lp->referenced = type; rc = true; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 666e5499c0d..61f2a4732c1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-02-14 Harald Anlauf + + PR fortran/88248 + * gfortran.dg/pr88248.f90: New test. + * gfortran.dg/f2018_obs.f90: Updated test. + 2019-02-14 Tamar Christina * gcc.target/arm/pr88850.c: change options to additional option. diff --git a/gcc/testsuite/gfortran.dg/f2018_obs.f90 b/gcc/testsuite/gfortran.dg/f2018_obs.f90 index 0a8dca9706a..d99934b8739 100644 --- a/gcc/testsuite/gfortran.dg/f2018_obs.f90 +++ b/gcc/testsuite/gfortran.dg/f2018_obs.f90 @@ -19,8 +19,8 @@ program f2018_obs equivalence (a(10),b(1)) ! { dg-warning "obsolescent feature" } - do 99 i=1,10 -99 continue ! { dg-warning "obsolescent feature" } + do 99 i=1,10 ! { dg-warning "obsolescent feature" } +99 continue j = (/ 0, 1, 2, 3, 4, 0, 6, 7 /) forall (i=1:8, j(i) /= 0) ! { dg-warning "obsolescent feature" } diff --git a/gcc/testsuite/gfortran.dg/pr88248.f90 b/gcc/testsuite/gfortran.dg/pr88248.f90 new file mode 100644 index 00000000000..2a49305e70a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr88248.f90 @@ -0,0 +1,28 @@ +! { dg-do compile } +! { dg-options "-std=f2018" } +! +! PR88248 - [F18] Bogus warning about obsolescent feature: Labeled DO statement +! +program pr88248 + character*80 text ! { dg-warning "Old-style character length" } + f(x) = x ! { dg-warning "Statement function" } + call foo (*99) ! { dg-warning "Alternate-return argument" } + data y / 1.0 / ! { dg-warning "DATA statement" } + goto (1,99) i+1 ! { dg-warning "Computed GOTO" } + ! No warning should be printed below + goto 1 +1 continue + open (10, err=99) + close (10, err=99) + backspace (10, err=99) + endfile (10, err=99) + rewind (10, err=99) + flush (10, err=99) + inquire (10, err=99) + read (*, end=99) text +99 continue +end + +subroutine foobar () +entry bar () ! { dg-warning "ENTRY statement" } +end subroutine foobar