[patch, fortran, 4.9] Dependency and string length calculation improvements
Thomas Koenig
tkoenig@netcologne.de
Sat Mar 16 14:54:00 GMT 2013
Hello world,
below is a patch which improves dependency checking for array
assignments and calculation of string lengths.
The new function gfc_dep_difference is used for both. This allows
us to detect, for example, that the difference between the lower
indices of
a(n:m:2) = a(n+1:m+1:2)
is one, thus making an array temporary unnecessary.
I have tried to cover every code path through gfc_dep_difference in
string_length_2.f90. dependency_40.f90 is just there to test
the basic functionality.
OK for trunk?
Thomas
2013-03-16 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/45159
* gfortran.h (gfc_dep_difference): Add prototype.
* dependency.c (discard_nops): New function.
(gfc_dep_difference): New function.
(check_section_vs_section): Use gfc_dep_difference
to calculate the difference of starting indices.
* trans-expr.c (gfc_conv_substring): Use
gfc_dep_difference to calculate the length of
substrings where possible.
2013-03-16 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/45159
* gfortran.dg/string_length_2.f90: New test.
* gfortran.dg/dependency_40.f90: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p6.diff
Type: text/x-patch
Size: 10600 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20130316/006da8c6/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dependency_40.f90
Type: text/x-fortran
Size: 230 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20130316/006da8c6/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: string_length_2.f90
Type: text/x-fortran
Size: 1841 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20130316/006da8c6/attachment-0002.bin>
More information about the Fortran
mailing list