[Patch, fortran] PR35339 Optimize implied do loops in io statements

Nicolas Koenig koenigni@student.ethz.ch
Sat May 27 21:47:00 GMT 2017


Hello everyone,

attached is a patch to simplify implied do loops in io statements by 
replacing them with their respective array slices. For example "WRITE 
(*,*) (a(i), i=1,4,2)" becomes "WRITE (*,*) a(1:4:2)".

Ok for trunk?

Nicolas

Regression tested for x85_64-pc-linux-gnu.

Changelog:
2017-05-27  Nicolas Koenig  <koenigni@student.ethz.ch>

         PR fortran/35339
         * frontend-passes.c (traverse_io_block): New function.
         (simplify_io_impl_do): New function.
         (optimize_namespace): Invoke gfc_code_walker with
         simplify_io_impl_do.

2017-05-27  Nicolas Koenig  <koenigni@student.ethz.ch>

         PR fortran/35339
         * gfortran.dg/implied_do_io_1.f90: New Test.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: p4.diff
Type: text/x-patch
Size: 7658 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170527/2b609740/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: implied_do_io_1.f90
Type: text/x-fortran
Size: 1449 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170527/2b609740/attachment-0001.bin>


More information about the Gcc-patches mailing list