Commit d4f8b567 by Roger Sayle Committed by Roger Sayle

dependency.c (gfc_check_dependency): Implement dependency checking for array constructors.


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

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

From-SVN: r121490
parent 2ad62c9b
2007-02-01 Roger Sayle <roger@eyesopen.com> 2007-02-01 Roger Sayle <roger@eyesopen.com>
* dependency.c (gfc_check_dependency) <EXPR_ARRAY>: Implement
dependency checking for array constructors.
2007-02-01 Roger Sayle <roger@eyesopen.com>
* trans-stmt.c (compute_overall_iter_number): Document function * trans-stmt.c (compute_overall_iter_number): Document function
arguments. Generalize "unconditional forall nest with constant arguments. Generalize "unconditional forall nest with constant
bounds" optimization to eliminate unconditional inner loops with bounds" optimization to eliminate unconditional inner loops with
......
...@@ -599,9 +599,10 @@ gfc_are_equivalenced_arrays (gfc_expr *e1, gfc_expr *e2) ...@@ -599,9 +599,10 @@ gfc_are_equivalenced_arrays (gfc_expr *e1, gfc_expr *e2)
int int
gfc_check_dependency (gfc_expr *expr1, gfc_expr *expr2, bool identical) gfc_check_dependency (gfc_expr *expr1, gfc_expr *expr2, bool identical)
{ {
gfc_actual_arglist *actual;
gfc_constructor *c;
gfc_ref *ref; gfc_ref *ref;
int n; int n;
gfc_actual_arglist *actual;
gcc_assert (expr1->expr_type == EXPR_VARIABLE); gcc_assert (expr1->expr_type == EXPR_VARIABLE);
...@@ -685,8 +686,19 @@ gfc_check_dependency (gfc_expr *expr1, gfc_expr *expr2, bool identical) ...@@ -685,8 +686,19 @@ gfc_check_dependency (gfc_expr *expr1, gfc_expr *expr2, bool identical)
return 0; return 0;
case EXPR_ARRAY: case EXPR_ARRAY:
/* Probably ok in the majority of (constant) cases. */ /* Loop through the array constructor's elements. */
for (c = expr2->value.constructor; c; c = c->next)
{
/* If this is an iterator, assume the worst. */
if (c->iterator)
return 1; return 1;
/* Avoid recursion in the common case. */
if (c->expr->expr_type == EXPR_CONSTANT)
continue;
if (gfc_check_dependency (expr1, c->expr, 1))
return 1;
}
return 0;
default: default:
return 1; return 1;
......
2007-02-01 Roger Sayle <roger@eyesopen.com>
* gfortran.dg/dependency_20.f90: New test case.
2007-01-31 Ian Lance Taylor <iant@google.com> 2007-01-31 Ian Lance Taylor <iant@google.com>
* gcc.dg/lower-subreg-1.c (test): New test. * gcc.dg/lower-subreg-1.c (test): New test.
! { dg-do compile }
! { dg-options "-O2 -fdump-tree-original" }
integer :: a(4)
where (a(:) .ne. 0)
a(:) = (/ 1, 2, 3, 4 /)
endwhere
end
! { dg-final { scan-tree-dump-times "temp" 0 "original" } }
! { dg-final { cleanup-tree-dump "original" } }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment