This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch, fortran, committed] Fix PR 90563, error while warning about do subscripts


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.
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
! { dg-do compile }
! { dg-additional-options "-Wdo-subscript" }
! PR 90563 - this used to be rejected, wrongly
! Original test case by Tobias Neumann
program test
      implicit none
      integer, parameter :: swap(4) = [2,1,3,4]
      real :: p(20)
      integer :: j

      p = 0.0

      ! 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)) ! { dg-warning "out of bounds" }
          endif
      enddo
end program

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]