lang.opt: Add -Wdo-subscript.
authorThomas Koenig <tkoenig@gcc.gnu.org>
Mon, 25 Sep 2017 16:49:48 +0000 (16:49 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Mon, 25 Sep 2017 16:49:48 +0000 (16:49 +0000)
commit15e23330102f2c2a0815c70cf0ffca18fcdfdc40
treeac972b3706f15d894f99950f2eb6dd4519f8d5c5
parent58e17cf84636d72e3620b5af50b0336d9364ddd0
lang.opt: Add -Wdo-subscript.

2017-09-25  Thomas Koenig  <tkoenig@gcc.gnu.org>

* lang.opt:  Add -Wdo-subscript.
* frontend-passes.c (do_t): New type.
(doloop_list): Use variable of do_type.
(if_level): Variable to track if levels.
(select_level): Variable to track select levels.
(gfc_run_passes): Initialize i_level and select_level.
(doloop_code): Record current level of if + select
level in doloop_list.  Add seen_goto if there could
be a branch outside the loop. Use different type for
doloop_list.
(doloop_function): Call do_intent and do_subscript; move
functionality of checking INTENT to do_intent.
(insert_index_t): New type, for callback_insert_index.
(callback_insert_index): New function.
(insert_index): New function.
(do_subscript): New function.
(do_intent): New function.
(gfc_code_walker): Keep track of if_level and select_level.
* invoke.texi: Document -Wdo-subscript.

2017-09-25  Thomas Koenig  <tkoenig@gcc.gnu.org>

* gfortran.dg/do_subscript_1.f90: New test.
* gfortran.dg/do_subscript_2.f90: New test.
* gfortran.dg/gomp/associate1.f90: Add out of bounds warning.
* gfortran.dg/predcom-1.f: Adjust loop bounds.
* gfortran.dg/unconstrained_commons.f: Add out of bounds warning.

From-SVN: r253156
gcc/fortran/ChangeLog
gcc/fortran/frontend-passes.c
gcc/fortran/invoke.texi
gcc/fortran/lang.opt
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/do_subscript_1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/do_subscript_2.f90 [new file with mode: 0644]