[FORTRAN PATCH]: Implement dependency analysis for array constructors

Roger Sayle roger@eyesopen.com
Wed Jan 31 17:41:00 GMT 2007


The following is another improvement to the gfortran front-end's
dependency analysis routines.  Currently dependency.c doesn't know that
constant array constructors, such /( 1, 2, 3 /), aren't affected by
assignments to variables.  This then pessimizes code such as
"x(:) = cshift((/ 1, 2, 3, 4, 5/), 2)" or "reshape(x,(/2,2/))" where our
paranoia causes us to use temporary destination arrays to avoid the
imagined dependencies.

The simple/obvious fix is to actually implement the missing dependency
analysis for EXPR_ARRAY in gfc_check_dependency, by looping over the
values of the array constructor.

The following patch has been tested on x86_64-unknown-linux-gnu with a
full "make bootstrap", including gfortran, and regression tested with a
top-level "make -k check" with no new failures.

Ok for mainline?


2007-01-31  Roger Sayle  <roger@eyesopen.com>

        * dependency.c (gfc_check_dependency) <EXPR_ARRAY>: Implement
        dependency checking for array constructors.

        * gfortran.dg/dependency_20.f90: New test case.


Roger
--
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patchf2.txt
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070131/cddbdb48/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dependency_20.f90
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070131/cddbdb48/attachment.f90>


More information about the Fortran mailing list