[Bug fortran/91424] Extend warnings about DO loops

2019-08-13 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91424

Thomas Koenig  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Thomas Koenig  ---
Fixed on trunk and gcc-9.

[Bug fortran/91424] Extend warnings about DO loops

2019-08-13 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91424
Bug 91424 depends on bug 91422, which changed state.

Bug 91422 Summary: Illegal Fortran in 
testsuite/libgomp.oacc-fortran/routine-7.f90
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91422

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

[Bug fortran/91424] Extend warnings about DO loops

2019-08-13 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91424

--- Comment #6 from Thomas Koenig  ---
Author: tkoenig
Date: Tue Aug 13 10:05:44 2019
New Revision: 274369

URL: https://gcc.gnu.org/viewcvs?rev=274369=gcc=rev
Log:
2019-08-13  Thomas Koenig  

Backport from trunk
PR fortran/91424
* frontend-passes.c (do_subscript): Do not warn for an
expression a second time.  Do not warn about a zero-trip loop.
(doloop_warn): Also look at contained namespaces.

2019-08-13  Thomas Koenig  

Backport from trunk
PR fortran/91424
* gfortran.dg/do_subscript_3.f90: New test.
* gfortran.dg/do_subscript_4.f90: New test.
* gfortran.dg/pr70754.f90: Use indices that to not overflow.

2019-08-13  Thomas Koenig  

Backport from trunk
PR fortran/91422
* testsuite/libgomp.oacc-fortran/routine-7.f90: Correct array
dimension.


Added:
branches/gcc-9-branch/gcc/testsuite/gfortran.dg/do_subscript_3.f90
branches/gcc-9-branch/gcc/testsuite/gfortran.dg/do_subscript_4.f90
Modified:
branches/gcc-9-branch/gcc/fortran/ChangeLog
branches/gcc-9-branch/gcc/fortran/frontend-passes.c
branches/gcc-9-branch/gcc/testsuite/ChangeLog
branches/gcc-9-branch/gcc/testsuite/gfortran.dg/pr70754.f90
branches/gcc-9-branch/libgomp/ChangeLog
branches/gcc-9-branch/libgomp/testsuite/libgomp.oacc-fortran/routine-7.f90

[Bug fortran/91424] Extend warnings about DO loops

2019-08-12 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91424

--- Comment #5 from Thomas Koenig  ---
Author: tkoenig
Date: Mon Aug 12 20:21:37 2019
New Revision: 274320

URL: https://gcc.gnu.org/viewcvs?rev=274320=gcc=rev
Log:
2019-08-12  Thomas Koenig  

PR fortran/91424
* frontend-passes.c (do_subscript): Do not warn for an
expression a second time.  Do not warn about a zero-trip loop.
(doloop_warn): Also look at contained namespaces.

2019-08-12  Thomas Koenig  

PR fortran/91424
* gfortran.dg/do_subscript_3.f90: New test.
* gfortran.dg/do_subscript_4.f90: New test.
* gfortran.dg/pr70754.f90: Use indices that to not overflow.

2019-08-12  Thomas Koenig  

PR fortran/91422
* testsuite/libgomp.oacc-fortran/routine-7.f90: Correct array
dimension.


Added:
trunk/gcc/testsuite/gfortran.dg/do_subscript_3.f90
trunk/gcc/testsuite/gfortran.dg/do_subscript_4.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/frontend-passes.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/pr70754.f90
trunk/libgomp/ChangeLog
trunk/libgomp/testsuite/libgomp.oacc-fortran/routine-7.f90

[Bug fortran/91424] Extend warnings about DO loops

2019-08-12 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91424

--- Comment #4 from Thomas Koenig  ---
(In reply to Eric Gallager from comment #2)

> - the "2" location marker is a different color from the "1" location marker,
> if you have colorized output

That is now PR 91426.

[Bug fortran/91424] Extend warnings about DO loops

2019-08-12 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91424

--- Comment #3 from Thomas Koenig  ---
(In reply to Eric Gallager from comment #2)
> Also:
> - there's no option flag controlling the warning

That one is by design.  There is no way that this can even
be valid code.

> - the "2" location marker is a different color from the "1" location marker,
> if you have colorized output

How would I change that?

[Bug fortran/91424] Extend warnings about DO loops

2019-08-12 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91424

Eric Gallager  changed:

   What|Removed |Added

   Keywords||diagnostic
 CC||egallager at gcc dot gnu.org

--- Comment #2 from Eric Gallager  ---
Also:
- there's no option flag controlling the warning
- the "2" location marker is a different color from the "1" location marker, if
you have colorized output

[Bug fortran/91424] Extend warnings about DO loops

2019-08-12 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91424

--- Comment #1 from Thomas Koenig  ---
A third problem: Zero-trip do loops are warned about.

program main
  implicit none
  integer :: i
  real :: a(2)
  do i=1,3,-1
 a(i) = 2.
  end do
  print *,a
end program main

gets

do_subscript_4.f90:6:7:

5 |   do i=1,3,-1
  | 2
6 |  a(i) = 2.
  |   1
Warning: Array reference at (1) out of bounds (3 > 2) in loop beginning at (2)