summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-03-01 14:40:28 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-03-01 14:40:28 +0000
commita7455f80b040fa38efe90b73411a4911888e86b4 (patch)
tree6f7332e67bcab8cb1604dc9e16c929b3c5613197 /gcc
parente29d5ed87ec48e7925499e5d7c1c529ca73f62a2 (diff)
downloadgcc-a7455f80b040fa38efe90b73411a4911888e86b4.tar.gz
* dependency.c (gfc_is_same_range): Compare the stride, lower and
upper bounds when testing array reference ranges for equality. (gfc_check_dependency): Fix indentation whitespace. (gfc_check_element_vs_element): Likewise. (gfc_dep_resolver): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111601 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/dependency.c68
2 files changed, 53 insertions, 23 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 8ed4f912b80..d9b2abee66b 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,11 @@
+2006-03-01 Roger Sayle <roger@eyesopen.com>
+
+ * dependency.c (gfc_is_same_range): Compare the stride, lower and
+ upper bounds when testing array reference ranges for equality.
+ (gfc_check_dependency): Fix indentation whitespace.
+ (gfc_check_element_vs_element): Likewise.
+ (gfc_dep_resolver): Likewise.
+
2006-02-28 Thomas Koenig <Thomas.Koenig@online.de>
* trans-intrinsic.c (gfc_conv_intrinsic_minmaxloc):
diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c
index df6609bf949..96da3c31e4b 100644
--- a/gcc/fortran/dependency.c
+++ b/gcc/fortran/dependency.c
@@ -150,28 +150,50 @@ gfc_is_same_range (gfc_array_ref * ar1, gfc_array_ref * ar2, int n, int def)
/* Check the range start. */
e1 = ar1->start[n];
e2 = ar2->start[n];
+ if (e1 || e2)
+ {
+ /* Use the bound of the array if no bound is specified. */
+ if (ar1->as && !e1)
+ e1 = ar1->as->lower[n];
- if (!(e1 || e2))
- return 1;
+ if (ar2->as && !e2)
+ e2 = ar2->as->lower[n];
- /* Use the bound of the array if no bound is specified. */
- if (ar1->as && !e1)
- e1 = ar1->as->lower[n];
+ /* Check we have values for both. */
+ if (!(e1 && e2))
+ return def;
- if (ar2->as && !e2)
- e2 = ar2->as->lower[n];
+ i = gfc_dep_compare_expr (e1, e2);
+ if (i == -2)
+ return def;
+ else if (i != 0)
+ return 0;
+ }
- /* Check we have values for both. */
- if (!(e1 && e2))
- return def;
+ /* Check the range end. */
+ e1 = ar1->end[n];
+ e2 = ar2->end[n];
+ if (e1 || e2)
+ {
+ /* Use the bound of the array if no bound is specified. */
+ if (ar1->as && !e1)
+ e1 = ar1->as->upper[n];
- i = gfc_dep_compare_expr (e1, e2);
+ if (ar2->as && !e2)
+ e2 = ar2->as->upper[n];
- if (i == -2)
- return def;
- else if (i == 0)
- return 1;
- return 0;
+ /* Check we have values for both. */
+ if (!(e1 && e2))
+ return def;
+
+ i = gfc_dep_compare_expr (e1, e2);
+ if (i == -2)
+ return def;
+ else if (i != 0)
+ return 0;
+ }
+
+ return 1;
}
@@ -406,8 +428,8 @@ gfc_check_dependency (gfc_expr * expr1, gfc_expr * expr2, bool identical)
if (expr2->inline_noncopying_intrinsic)
identical = 1;
/* Remember possible differences between elemental and
- transformational functions. All functions inside a FORALL
- will be pure. */
+ transformational functions. All functions inside a FORALL
+ will be pure. */
for (actual = expr2->value.function.actual;
actual; actual = actual->next)
{
@@ -673,7 +695,7 @@ gfc_check_element_vs_element (gfc_ref * lref, gfc_ref * rref, int n)
l_start = l_ar.start[n] ;
r_start = r_ar.start[n] ;
if (gfc_dep_compare_expr (r_start, l_start) == 0)
- nIsDep = GFC_DEP_EQUAL;
+ nIsDep = GFC_DEP_EQUAL;
else
nIsDep = GFC_DEP_NODEP;
}
@@ -704,7 +726,7 @@ gfc_dep_resolver (gfc_ref * lref, gfc_ref * rref)
while (lref && rref)
{
/* We're resolving from the same base symbol, so both refs should be
- the same type. We traverse the reference chain intil we find ranges
+ the same type. We traverse the reference chain intil we find ranges
that are not equal. */
gcc_assert (lref->type == rref->type);
switch (lref->type)
@@ -725,7 +747,7 @@ gfc_dep_resolver (gfc_ref * lref, gfc_ref * rref)
for (n=0; n < lref->u.ar.dimen; n++)
{
/* Assume dependency when either of array reference is vector
- subscript. */
+ subscript. */
if (lref->u.ar.dimen_type[n] == DIMEN_VECTOR
|| rref->u.ar.dimen_type[n] == DIMEN_VECTOR)
return 1;
@@ -741,7 +763,7 @@ gfc_dep_resolver (gfc_ref * lref, gfc_ref * rref)
else
{
gcc_assert (rref->u.ar.dimen_type[n] == DIMEN_ELEMENT
- && lref->u.ar.dimen_type[n] == DIMEN_ELEMENT);
+ && lref->u.ar.dimen_type[n] == DIMEN_ELEMENT);
this_dep = gfc_check_element_vs_element (rref, lref, n);
}
@@ -750,7 +772,7 @@ gfc_dep_resolver (gfc_ref * lref, gfc_ref * rref)
return 0;
/* Overlap codes are in order of priority. We only need to
- know the worst one.*/
+ know the worst one.*/
if (this_dep > fin_dep)
fin_dep = this_dep;
}