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
This commit is contained in:
parent
2ad62c9b34
commit
d4f8b5672a
4 changed files with 34 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
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
|
||||
|
|
|
@ -599,9 +599,10 @@ gfc_are_equivalenced_arrays (gfc_expr *e1, gfc_expr *e2)
|
|||
int
|
||||
gfc_check_dependency (gfc_expr *expr1, gfc_expr *expr2, bool identical)
|
||||
{
|
||||
gfc_actual_arglist *actual;
|
||||
gfc_constructor *c;
|
||||
gfc_ref *ref;
|
||||
int n;
|
||||
gfc_actual_arglist *actual;
|
||||
|
||||
gcc_assert (expr1->expr_type == EXPR_VARIABLE);
|
||||
|
||||
|
@ -685,8 +686,19 @@ gfc_check_dependency (gfc_expr *expr1, gfc_expr *expr2, bool identical)
|
|||
return 0;
|
||||
|
||||
case EXPR_ARRAY:
|
||||
/* Probably ok in the majority of (constant) cases. */
|
||||
return 1;
|
||||
/* 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;
|
||||
/* 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:
|
||||
return 1;
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
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>
|
||||
|
||||
* gcc.dg/lower-subreg-1.c (test): New test.
|
||||
|
|
10
gcc/testsuite/gfortran.dg/dependency_20.f90
Normal file
10
gcc/testsuite/gfortran.dg/dependency_20.f90
Normal file
|
@ -0,0 +1,10 @@
|
|||
! { 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" } }
|
Loading…
Add table
Reference in a new issue