From 12de6bc686b5e794c2ae69c96b54825ef43c5e3e Mon Sep 17 00:00:00 2001 From: Roger Sayle Date: Fri, 3 Mar 2006 21:47:24 +0000 Subject: [PATCH] dependency.c (gfc_check_element_vs_element): Consider two unordered scalar subscripts as (potentially) equal. * dependency.c (gfc_check_element_vs_element): Consider two unordered scalar subscripts as (potentially) equal. * gfortran.dg/dependency_9.f90: New test case. From-SVN: r111687 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/dependency.c | 8 +++++++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gfortran.dg/dependency_9.f90 | 13 +++++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/dependency_9.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 07350f469cc..4edafa6f995 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2006-03-03 Roger Sayle + + * dependency.c (gfc_check_element_vs_element): Consider two + unordered scalar subscripts as (potentially) equal. + 2006-03-03 Roger Sayle * dependency.c (gfc_check_dependency): Call gfc_dep_resolver to diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c index 187b2077716..129caa361ad 100644 --- a/gcc/fortran/dependency.c +++ b/gcc/fortran/dependency.c @@ -739,8 +739,14 @@ gfc_check_element_vs_element (gfc_ref * lref, gfc_ref * rref, int n) i = gfc_dep_compare_expr (r_start, l_start); if (i == 0) return GFC_DEP_EQUAL; + /* Treat two scalar variables as potentially equal. This allows + us to prove that a(i,:) and a(j,:) have no dependency. See + Gerald Roth, "Evaluation of Array Syntax Dependence Analysis", + Proceedings of the International Conference on Parallel and + Distributed Processing Techniques and Applications (PDPTA2001), + Las Vegas, Nevada, June 2001. This used to be GFC_DEP_OVERLAP. */ if (i == -2) - return GFC_DEP_OVERLAP; + return GFC_DEP_EQUAL; return GFC_DEP_NODEP; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c56b0f935f5..12617066d39 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2006-03-03 Roger Sayle + + * gfortran.dg/dependency_9.f90: New test case. + 2006-03-03 Roger Sayle * gfortran.dg/dependency_4.f90: New test case. diff --git a/gcc/testsuite/gfortran.dg/dependency_9.f90 b/gcc/testsuite/gfortran.dg/dependency_9.f90 new file mode 100644 index 00000000000..d1f6f5e3fed --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dependency_9.f90 @@ -0,0 +1,13 @@ +! { dg-do compile } +! { dg-options "-O2 -fdump-tree-original" } +subroutine foo(a,i,j) + integer, dimension (4,4) :: a + integer :: i + integer :: j + + where (a(i,:) .ne. 0) + a(j,:) = 1 + endwhere +end subroutine +! { dg-final { scan-tree-dump-times "malloc" 0 "original" } } +! { dg-final { cleanup-tree-dump "original" } }