[fortran,committed] Fix PR 90563, error while warning about do subscripts
diff mbox series

Message ID 8cc23159-6c8e-9a88-eeb6-bb3e36453d78@netcologne.de
State New
Headers show
Series
  • [fortran,committed] Fix PR 90563, error while warning about do subscripts
Related show

Commit Message

Thomas Koenig Aug. 13, 2019, 6:50 p.m. UTC
Hi,

I just committed as simple and obvious the patch below. This
fixes a 8/9/10 regression where a false positive with -Wdo-subscript
(which we know about) was compounded by an also invalid error.

Fixed by suppressing errors at the right time.

I will also commit the patch to the other affected branches.

Regards

	Thomas

2013-08-13  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/90563
	* frontend-passes.c (insert_index): Suppress errors while
	simplifying the resulting expression.

2013-08-13  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/90563
	* gfortran.dg/do_subsript_5.f90: New test.

Patch
diff mbox series

Index: testsuite/gfortran.dg/do_subscript_5.f90
===================================================================
--- testsuite/gfortran.dg/do_subscript_5.f90	(Revision 274394)
+++ testsuite/gfortran.dg/do_subscript_5.f90	(Arbeitskopie)
@@ -1,4 +1,5 @@ 
 ! { dg-do compile }
+! { dg-additional-options "-Wdo-subscript" }
 ! PR 90563 - this used to be rejected, wrongly
 ! Original test case by Tobias Neumann
 program test
@@ -9,9 +10,11 @@ 
 
       p = 0.0
 
-      do j=1,6
+      ! The following warnings are actually bogus, but we are not yet
+      ! clever enough to suppress them.
+      do j=1,6 ! { dg-warning "out of bounds" }
           if (j<5) then
-              p(j) = p(swap(j))
+              p(j) = p(swap(j)) ! { dg-warning "out of bounds" }
           endif
       enddo
 end program