[patch, fortran] Follow references in dependency checking

Thomas Koenig tkoenig@netcologne.de
Sun Aug 1 13:58:00 GMT 2010


Hello world,

here's a patch which improves dependency checking.  Both substring and
array references are followed with this, so we can also avoid using
temporaries for array expressions like

    a(i(1):i(2)) = a(i(1):i(2)) + b(i(1):i(2))
    a(c%i:c%j) = a(c%i:c%j) + b(c%k:c%m)

String references are also handled, so expressions like
c(1:2) == c(1:2) can now be removed.  See the test cases.

Regression-tested on x86_64-unknown-linux-gnu.  OK for trunk?

	Thomas

2010-08-01  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/36854
	* dependency.h:  Add prototype for gfc_are_identical_variables.
	* frontend-passes.c:  Include depencency.h.
	(optimimize_equality):  Use gfc_are_identical_variables.
	* dependency.c (identical_array_ref): New function.
	(identical_substring_ref):  New function.
	(gfc_are_identical_variables):  New function.
	(gfc_deb_compare_expr):  Use gfc_are_identical_variables.
	* dependency.c (gfc_check_section_vs_section).  Rename gfc_
	prefix from statc function.
	(check_section_vs_section): Change arguments to gfc_array_ref,
	adjust function body accordingly.

2010-08-01  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/36854
	* gfortran.dg/character_comparison_2.f90:  New test.
	* gfortran.dg/dependency_28.f90:  New test.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: p2.diff
Type: text/x-patch
Size: 8640 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20100801/c389cf2e/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: character_comparison_2.f90
Type: text/x-fortran
Size: 964 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20100801/c389cf2e/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dependency_28.f90
Type: text/x-fortran
Size: 620 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20100801/c389cf2e/attachment-0002.bin>


More information about the Fortran mailing list