summaryrefslogtreecommitdiff
path: root/gcc/fortran/dependency.c
diff options
context:
space:
mode:
authortkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2013-07-21 13:44:03 +0000
committertkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2013-07-21 13:44:03 +0000
commit7243e97994be84af55832f64e3b9dedb6ad3bc8e (patch)
treefe1ec330c9c583ea303c069de034b2b9f4ef20ce /gcc/fortran/dependency.c
parenteb429e06e58399fde96c4b57d5fc749606db6091 (diff)
downloadgcc-7243e97994be84af55832f64e3b9dedb6ad3bc8e.tar.gz
2013-07-21 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/56937 * dependency.c (gfc_dep_resolver): Treat identical array subscripts as identical; don't unconditionally return a dependency if an array subscript is found. 2013-07-21 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/56937 * gfortran.dg/dependency_42.f90: New test. * gfortran.dg/dependency_43.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201094 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/dependency.c')
-rw-r--r--gcc/fortran/dependency.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c
index fcdc1e50177..350c7bd07a2 100644
--- a/gcc/fortran/dependency.c
+++ b/gcc/fortran/dependency.c
@@ -2095,11 +2095,23 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse)
for (n=0; n < lref->u.ar.dimen; n++)
{
- /* Assume dependency when either of array reference is vector
- subscript. */
+ /* Handle dependency when either of array reference is vector
+ subscript. There is no dependency if the vector indices
+ are equal or if indices are known to be different in a
+ different dimension. */
if (lref->u.ar.dimen_type[n] == DIMEN_VECTOR
|| rref->u.ar.dimen_type[n] == DIMEN_VECTOR)
- return 1;
+ {
+ if (lref->u.ar.dimen_type[n] == DIMEN_VECTOR
+ && rref->u.ar.dimen_type[n] == DIMEN_VECTOR
+ && gfc_dep_compare_expr (lref->u.ar.start[n],
+ rref->u.ar.start[n]) == 0)
+ this_dep = GFC_DEP_EQUAL;
+ else
+ this_dep = GFC_DEP_OVERLAP;
+
+ goto update_fin_dep;
+ }
if (lref->u.ar.dimen_type[n] == DIMEN_RANGE
&& rref->u.ar.dimen_type[n] == DIMEN_RANGE)
@@ -2164,6 +2176,8 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse)
/* Overlap codes are in order of priority. We only need to
know the worst one.*/
+
+ update_fin_dep:
if (this_dep > fin_dep)
fin_dep = this_dep;
}