Optimize fortran loops with +-1 step.
commit95c9caad44210c7cdf4ed85f07331fdf7645ceec
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 7 Jul 2016 13:15:39 +0000 (7 13:15 +0000)
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 7 Jul 2016 13:15:39 +0000 (7 13:15 +0000)
tree22f4b1f8abca321823c347e6673350df6ccef09d
parentff92566aeffdb9ffb5c716a6adad306407476e83
Optimize fortran loops with +-1 step.

* gfortran.dg/do_1.f90: Remove a corner case that triggers
an undefined behavior.
* gfortran.dg/do_3.F90: Likewise.
* gfortran.dg/do_check_11.f90: New test.
* gfortran.dg/do_check_12.f90: New test.
* gfortran.dg/do_corner_warn.f90: New test.
* lang.opt (Wundefined-do-loop): New option.
        * resolve.c (gfc_resolve_iterator): Warn for Wundefined-do-loop.
(gfc_trans_simple_do): Generate a c-style loop.
(gfc_trans_do): Fix GNU coding style.
* invoke.texi: Mention the new warning.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@238114 138bc75d-0d04-0410-961f-82ee72b054a4
13 files changed:
gcc/fortran/ChangeLog
gcc/fortran/invoke.texi
gcc/fortran/lang.opt
gcc/fortran/resolve.c
gcc/fortran/trans-stmt.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/do_1.f90
gcc/testsuite/gfortran.dg/do_3.F90
gcc/testsuite/gfortran.dg/do_check_11.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/do_check_12.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/do_corner_warn.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/ldist-1.f90
gcc/testsuite/gfortran.dg/pr48636.f90