From: Paul Brook Date: Sat, 29 May 2004 01:21:51 +0000 (+0000) Subject: trans-common.c (find_equivalence): Find multiple rules. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=353c3b7e16645aa9e2be04e80707e256965642e4;p=gcc.git trans-common.c (find_equivalence): Find multiple rules. * trans-common.c (find_equivalence): Find multiple rules. testsuite/ * gfortran.fortran-torture/execute/equiv_1.f90: New test. From-SVN: r82411 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 69fa1f563c6..786cc39077e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,7 @@ +2004-05-29 Paul Brook + + * trans-common.c (find_equivalence): Find multiple rules. + 2004-05-27 Tobias Schlueter * gfortran.h (gfc_current_locus, gfc_set_locus): Remove. diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c index 458dbeff368..74842847307 100644 --- a/gcc/fortran/trans-common.c +++ b/gcc/fortran/trans-common.c @@ -649,7 +649,8 @@ add_condition (segment_info *f, gfc_equiv *eq1, gfc_equiv *eq2) /* Given a segment element, search through the equivalence lists for unused - conditions that involve the symbol. Add these rules to the segment. */ + conditions that involve the symbol. Add these rules to the segment. Only + checks for rules involving the first symbol in the equivalence set. */ static bool find_equivalence (segment_info *f) @@ -666,7 +667,7 @@ find_equivalence (segment_info *f) if (l->used) continue; - if (c->expr->symtree->n.sym ==f-> sym) + if (c->expr->symtree->n.sym == f-> sym) { eq = c; other = l; @@ -682,9 +683,12 @@ find_equivalence (segment_info *f) if (eq) { add_condition (f, eq, other); - l->used = 1; + eq->used = 1; found = TRUE; - break; + /* If this symbol is the fist in the chain we may find other + matches. Otherwise we can skip to the next equivalence. */ + if (eq == l) + break; } } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c4201215571..96b7c937765 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-05-29 Paul Brook + + * gfortran.fortran-torture/execute/equiv_1.f90: New test. + 2004-05-28 Ziemowit Laski * gcc.dg/altivec-16.c: New test. diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/equiv_1.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/equiv_1.f90 new file mode 100644 index 00000000000..b4719fcaa4a --- /dev/null +++ b/gcc/testsuite/gfortran.fortran-torture/execute/equiv_1.f90 @@ -0,0 +1,15 @@ +program prog + common /block/ i + equivalence (a, b, c), (i, j, k ,l) + a = 1.0 + b = 2.0 + c = 3.0 + i = 1 + j = 2 + k = 3 + l = 4 + + if ((a .ne. 3.0) .or. (b .ne. 3.0) .or. (c .ne. 3.0)) call abort () + if ((i .ne. 4) .or. (j .ne. 4) .or. (k .ne. 4) .or. (l .ne. 4)) & + call abort () +end program