[patch, fortran] PR 30146, errors for INTENT(OUT) and INTENT(INOUT) for DO loop variables

Thomas Koenig tkoenig@netcologne.de
Thu Nov 1 12:58:00 GMT 2012


Hello world,

after the dicsussion on c.l.f, it become clear that passing a DO loop
variable to an INTENT(OUT) or INTENT(INOUT) dummy argument is an error.
The attached patch throws an error for both cases.

I chose to issue the errors as a front-end pass because we cannot check
for formal arguments during parsing (where the other checks are
implemented).

Regression-tested.  OK for trunk?

	Thomas

2012-11-01  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/30146
         * frontend-passes.c (do_warn):  New function.
         (do_list):  New static variable.
         (do_size):  New static variable.
         (do_list):  New static variable.
         (gfc_run_passes): Call do_warn.
         (do_code):  New function.
         (do_function):  New function.
         (gfc_code_walker):  Keep track fo DO level.

2012-11-01  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/30146
         * gfortran.dg/do_check_6.f90:  New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p5.diff
Type: text/x-patch
Size: 5694 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20121101/f852b8bb/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: do_check_6.f90
Type: text/x-fortran
Size: 1161 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20121101/f852b8bb/attachment-0001.bin>


More information about the Fortran mailing list