Optimize fortran loops with +-1 step.
authorMartin Liska <mliska@suse.cz>
Thu, 7 Jul 2016 13:15:39 +0000 (15:15 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Thu, 7 Jul 2016 13:15:39 +0000 (13:15 +0000)
commit1c122092dcf48801c638abdf070f18c6fe025ad6
tree22f4b1f8abca321823c347e6673350df6ccef09d
parent9cc6b3f86acd4911d6cbd6f57cb3148c52e89d38
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.

From-SVN: r238114
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