public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PR fortran/88248, patch] - [F18] Bogus warning about obsolescent feature: Labeled DO statement
@ 2019-02-13 22:38 Harald Anlauf
  2019-02-13 22:50 ` Harald Anlauf
  2019-02-14  0:46 ` Jerry DeLisle
  0 siblings, 2 replies; 4+ messages in thread
From: Harald Anlauf @ 2019-02-13 22:38 UTC (permalink / raw)
  To: gfortran, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 504 bytes --]

The attached patch moves the check for labeled DO statements to
the place where a label is referenced instead of where a label
was defined, which lead to false positives.

Regtested on x86_64-pc-linux-gnu.

OK for trunk?

Thanks,
Harald

2019-02-13  Harald Anlauf  <anlauf@gmx.de>

	PR fortran/88248
	* symbol.c: Move check for labeled DO statement from
	gfc_define_st_label to gfc_reference_st_label.

2019-02-13  Harald Anlauf  <anlauf@gmx.de>

	PR fortran/88248
	* gfortran.dg/pr88248.f90: New test.


[-- Attachment #2: patch-pr88248 --]
[-- Type: text/plain, Size: 845 bytes --]

Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c	(revision 268826)
+++ gcc/fortran/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", &gfc_current_locus))
+    return false;
+
   if (lp->referenced != ST_LABEL_DO_TARGET)
     lp->referenced = type;
   rc = true;

[-- Attachment #3: patch-pr88248-testcase --]
[-- Type: text/plain, Size: 1094 bytes --]

Index: gcc/testsuite/gfortran.dg/pr88248.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr88248.f90	(nonexistent)
+++ gcc/testsuite/gfortran.dg/pr88248.f90	(working copy)
@@ -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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PR fortran/88248, patch] - [F18] Bogus warning about obsolescent feature: Labeled DO statement
  2019-02-13 22:38 [PR fortran/88248, patch] - [F18] Bogus warning about obsolescent feature: Labeled DO statement Harald Anlauf
@ 2019-02-13 22:50 ` Harald Anlauf
  2019-02-14  0:46 ` Jerry DeLisle
  1 sibling, 0 replies; 4+ messages in thread
From: Harald Anlauf @ 2019-02-13 22:50 UTC (permalink / raw)
  To: gfortran, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 858 bytes --]

Sorry, forgot to attach the patch to the revised testcase f2018_obs.f90.
Here it is.

Regards,
Harald

Adjusted ChangeLog:

2019-02-13  Harald Anlauf  <anlauf@gmx.de>

	PR fortran/88248
	* gfortran.dg/pr88248.f90: New test.
	* gfortran.dg/f2018_obs.f90: Updated test.

On 02/13/19 23:38, Harald Anlauf wrote:
> The attached patch moves the check for labeled DO statements to
> the place where a label is referenced instead of where a label
> was defined, which lead to false positives.
> 
> Regtested on x86_64-pc-linux-gnu.
> 
> OK for trunk?
> 
> Thanks,
> Harald
> 
> 2019-02-13  Harald Anlauf  <anlauf@gmx.de>
> 
> 	PR fortran/88248
> 	* symbol.c: Move check for labeled DO statement from
> 	gfc_define_st_label to gfc_reference_st_label.
> 
> 2019-02-13  Harald Anlauf  <anlauf@gmx.de>
> 
> 	PR fortran/88248
> 	* gfortran.dg/pr88248.f90: New test.
> 


[-- Attachment #2: patch-pr88248-testcase-part2 --]
[-- Type: text/plain, Size: 634 bytes --]

Index: gcc/testsuite/gfortran.dg/f2018_obs.f90
===================================================================
--- gcc/testsuite/gfortran.dg/f2018_obs.f90	(revision 268826)
+++ gcc/testsuite/gfortran.dg/f2018_obs.f90	(working copy)
@@ -19,8 +19,8 @@
 
   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" }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PR fortran/88248, patch] - [F18] Bogus warning about obsolescent feature: Labeled DO statement
  2019-02-13 22:38 [PR fortran/88248, patch] - [F18] Bogus warning about obsolescent feature: Labeled DO statement Harald Anlauf
  2019-02-13 22:50 ` Harald Anlauf
@ 2019-02-14  0:46 ` Jerry DeLisle
  2019-02-14 20:27   ` Harald Anlauf
  1 sibling, 1 reply; 4+ messages in thread
From: Jerry DeLisle @ 2019-02-14  0:46 UTC (permalink / raw)
  To: Harald Anlauf, gfortran, gcc-patches

On 2/13/19 2:38 PM, Harald Anlauf wrote:
> The attached patch moves the check for labeled DO statements to
> the place where a label is referenced instead of where a label
> was defined, which lead to false positives.
> 
> Regtested on x86_64-pc-linux-gnu.
> 
> OK for trunk?
> 

Thanks Harald,

All OK with test case.

Jerry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PR fortran/88248, patch] - [F18] Bogus warning about obsolescent feature: Labeled DO statement
  2019-02-14  0:46 ` Jerry DeLisle
@ 2019-02-14 20:27   ` Harald Anlauf
  0 siblings, 0 replies; 4+ messages in thread
From: Harald Anlauf @ 2019-02-14 20:27 UTC (permalink / raw)
  To: Jerry DeLisle; +Cc: gfortran, gcc-patches

Commited as rev. 268895:

Sending        gcc/fortran/ChangeLog
Sending        gcc/fortran/symbol.c
Sending        gcc/testsuite/ChangeLog
Sending        gcc/testsuite/gfortran.dg/f2018_obs.f90
Adding         gcc/testsuite/gfortran.dg/pr88248.f90
Transmitting file data .....done
Committing transaction...
Committed revision 268895.

Thanks for the review, Jerry.

Harald

On 02/14/19 01:45, Jerry DeLisle wrote:
> On 2/13/19 2:38 PM, Harald Anlauf wrote:
>> The attached patch moves the check for labeled DO statements to
>> the place where a label is referenced instead of where a label
>> was defined, which lead to false positives.
>>
>> Regtested on x86_64-pc-linux-gnu.
>>
>> OK for trunk?
>>
> 
> Thanks Harald,
> 
> All OK with test case.
> 
> Jerry
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-14 20:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-13 22:38 [PR fortran/88248, patch] - [F18] Bogus warning about obsolescent feature: Labeled DO statement Harald Anlauf
2019-02-13 22:50 ` Harald Anlauf
2019-02-14  0:46 ` Jerry DeLisle
2019-02-14 20:27   ` Harald Anlauf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).