Hello. Following patch documents DO loop changes which were done for upcoming GCC 7.1.
Thanks for feedback, Martin
Index: htdocs/gcc-7/changes.html =================================================================== RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-7/changes.html,v retrieving revision 1.40 diff --unified -r1.40 changes.html --- htdocs/gcc-7/changes.html 25 Jan 2017 10:10:56 -0000 1.40 +++ htdocs/gcc-7/changes.html 25 Jan 2017 13:09:28 -0000 @@ -362,6 +362,27 @@ derived-type variables. </li> + <li> + DO loops with step equal to 1 or -1 generate faster code as they do not + have a loop preheader. New warning <code>-Wundefined-do-loop</code> + warns when a loop iterates either to <code>HUGE(i)</code> (with step equal + to 1), or to <code>-HUGE(i)</code> (with step equal to -1). Apart from + that the invalid behaviour can be caught during run-time of a program with + <code>-fcheck=do</code>: + <blockquote><pre> +program test + implicit none + integer(1) :: i + do i = -HUGE(i)+10, -HUGE(i)-1, -1 + print *, i + end do +end program test + +At line 8 of file /home/marxin/Programming/gcc/gcc/testsuite/gfortran.dg/do_check_12.f90 +Fortran runtime error: Loop iterates infinitely + </pre></blockquote> + </li> + </ul> <!-- <h3 id="go">Go</h3> -->