[Bug fortran/88248] [F18] Bogus warning about obsolescent feature: Labeled DO statement

2019-02-14 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88248

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #10 from Dominique d'Humieres  ---
> Fixed.

So closing!

[Bug fortran/88248] [F18] Bogus warning about obsolescent feature: Labeled DO statement

2019-02-14 Thread anlauf at gmx dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88248

--- Comment #9 from Harald Anlauf  ---
Fixed.

[Bug fortran/88248] [F18] Bogus warning about obsolescent feature: Labeled DO statement

2019-02-14 Thread anlauf at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88248

--- Comment #8 from anlauf at gcc dot gnu.org ---
Author: anlauf
Date: Thu Feb 14 20:24:54 2019
New Revision: 268895

URL: https://gcc.gnu.org/viewcvs?rev=268895=gcc=rev
Log:
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.


Added:
trunk/gcc/testsuite/gfortran.dg/pr88248.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/symbol.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/f2018_obs.f90

[Bug fortran/88248] [F18] Bogus warning about obsolescent feature: Labeled DO statement

2019-02-13 Thread anlauf at gmx dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88248

--- Comment #7 from Harald Anlauf  ---
Patch submitted:

https://gcc.gnu.org/ml/fortran/2019-02/msg00112.html

[Bug fortran/88248] [F18] Bogus warning about obsolescent feature: Labeled DO statement

2019-02-12 Thread anlauf at gmx dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88248

--- Comment #6 from Harald Anlauf  ---
Moving the check from gfc_define_st_label to gfc_reference_st_label:

Index: symbol.c
===
--- symbol.c(revision 268826)
+++ symbol.c(working copy)
@@ -2743,10 +2743,6 @@
  "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 @@
  "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", _current_locus))
+return false;
+
   if (lp->referenced != ST_LABEL_DO_TARGET)
 lp->referenced = type;
   rc = true;

fixes the issue for me.  It consequently needs adjustment to the test case
f2018_obs.f90, since it references the line with the "do 99 ..." instead
of the do termination line.

I am wondering about the location of the error marker.  E.g. for

subroutine gfcbug151 ()
  do 99 i = 1, 10
99   continue
end subroutine gfcbug151

I get:

gfcbug151.f90:2:17:

2 |   do 99 i = 1, 10
  | 1
Warning: Fortran 2018 obsolescent feature: Labeled DO statement at (1)

But I think this is ok.

Should I submit the above, or are there better suggestions?

[Bug fortran/88248] [F18] Bogus warning about obsolescent feature: Labeled DO statement

2018-12-21 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88248

--- Comment #5 from kargl at gcc dot gnu.org ---
(In reply to kargl from comment #4)
> (In reply to G. Steinmetz from comment #0)
> > Branching out via END=, ERR= or EOR= specifier in combination with
> > CONTINUE is interpreted as a labeled DO loop. Option -std=f2018 
> > misleadingly flags this with a warning -- (low prio).
> > 
> > 
> > $ cat z1.f90
> > program p
> >do
> >   rewind (1, err=99)
> >end do
> > 99 continue
> > end
> >

(snip)

> > 
> > $ gfortran-9-20181125 -c z1.f90 -std=f2008
> > $
> > $ gfortran-9-20181125 -c z1.f90 -std=f2018
> > z1.f90:5:2:
> > 
> > 5 | 99 continue
> >   |  1
> > Warning: Fortran 2018 obsolescent feature: Labeled DO statement at (1)
> 
> The warning was added by Janus in r260705.  I'll need to look
> deeper, but I don't think there is an easy way to distinguish
> between a labeled statement used as do-loop terminator and 
> a ordinary labeled statement.

Branching to any labeled CONTINUE statement will issue the warning.

program foo
   x = 42
   if (x < 0) goto 10
   goto 20
   print *, x
10 continue
   x = x + 1
20 continue
   x = x - 1
end program foo

% gfcx -std=f2018 -c a.f90
a.f90:6:2:

6 | 10 continue
  |  1
Warning: Fortran 2018 obsolescent feature: Labeled DO statement at (1)
a.f90:8:2:

8 | 20 continue
  |  1
Warning: Fortran 2018 obsolescent feature: Labeled DO statement at (1)

There isn't a do-loop in the code.  The offending part of
r260705 should be removed as it cannot be easily fixed.

[Bug fortran/88248] [F18] Bogus warning about obsolescent feature: Labeled DO statement

2018-12-21 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88248

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 CC||janus at gcc dot gnu.org,
   ||kargl at gcc dot gnu.org

--- Comment #4 from kargl at gcc dot gnu.org ---
(In reply to G. Steinmetz from comment #0)
> Branching out via END=, ERR= or EOR= specifier in combination with
> CONTINUE is interpreted as a labeled DO loop. Option -std=f2018 
> misleadingly flags this with a warning -- (low prio).
> 
> 
> $ cat z1.f90
> program p
>do
>   rewind (1, err=99)
>end do
> 99 continue
> end
> 
> 
> $ cat z2.f90
> program p
>character(3) :: c = 'abc'
>integer :: k
>do k = 1, 10
>   open (k, err=99)
>   close (k, err=99)
>   backspace (k, err=99)
>   endfile (k, err=99)
>   rewind (k, err=99)
>   flush (k, err=99)
>   inquire (k, err=99)
>   read (k, '(a)', end=97) c
>   read (k, '(a)', eor=98, advance='no') c
>   read (k, '(a)', err=99) c
>   write (k, '(a)', err=99) c
>   wait (k, end=97)
>   wait (k, eor=98)
>   wait (k, err=99)
>end do
> 97 continue
> 98 continue
> 99 continue
> end
> 
> 
> $ gfortran-9-20181125 -c z1.f90 -std=f2008
> $
> $ gfortran-9-20181125 -c z1.f90 -std=f2018
> z1.f90:5:2:
> 
> 5 | 99 continue
>   |  1
> Warning: Fortran 2018 obsolescent feature: Labeled DO statement at (1)

The warning was added by Janus in r260705.  I'll need to look
deeper, but I don't think there is an easy way to distinguish
between a labeled statement used as do-loop terminator and 
a ordinary labeled statement.

[Bug fortran/88248] [F18] Bogus warning about obsolescent feature: Labeled DO statement

2018-12-21 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88248

kargl at gcc dot gnu.org changed:

   What|Removed |Added

   Priority|P3  |P4

[Bug fortran/88248] [F18] Bogus warning about obsolescent feature: Labeled DO statement

2018-12-01 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88248

Dominique d'Humieres  changed:

   What|Removed |Added

 CC||anlauf at gmx dot de

--- Comment #3 from Dominique d'Humieres  ---
*** Bug 88300 has been marked as a duplicate of this bug. ***

[Bug fortran/88248] [F18] Bogus warning about obsolescent feature: Labeled DO statement

2018-12-01 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88248

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-12-01
 Ever confirmed|0   |1

--- Comment #2 from Dominique d'Humieres  ---
Confirmed.

[Bug fortran/88248] [F18] Bogus warning about obsolescent feature: Labeled DO statement

2018-11-28 Thread gs...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88248

--- Comment #1 from G. Steinmetz  ---

For completeness, similar with outdated return labels :


$ cat z3.f90
program p
   do
  call sub (*98, *99)
   end do
98 continue
99 continue
end


$ gfortran-9-20181125 -c z3.f90 -std=f2008
z3.f90:3:24:

3 |   call sub (*98, *99)
  |1
Warning: Obsolescent feature: Alternate-return argument at (1)


$ gfortran-9-20181125 -c z3.f90 -std=f2018
z3.f90:3:24:

3 |   call sub (*98, *99)
  |1
Warning: Obsolescent feature: Alternate-return argument at (1)
z3.f90:5:2:

5 | 98 continue
  |  1
Warning: Fortran 2018 obsolescent feature: Labeled DO statement at (1)
z3.f90:6:2:

6 | 99 continue
  |  1
Warning: Fortran 2018 obsolescent feature: Labeled DO statement at (1)