dependency checking for array constructors.
* gfortran.dg/dependency_20.f90: New test case.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121490
138bc75d-0d04-0410-961f-
82ee72b054a4
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
arguments. Generalize "unconditional forall nest with constant
bounds" optimization to eliminate unconditional inner loops with
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);
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;
+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.
--- /dev/null
+! { 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" } }