This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch to gfortran/13742


On Friday 28 May 2004 16:26, Tobias Schlüter wrote:
> I think this patch is responsible for PR 15641. The testcase from the PR
> works with a gfortran compiled before your change (May 19th), and the
> only ChangeLog entry which seems to affect this is this one.

Fixed as follows. A think on my part meant we were missing equivalence rules.

Paul

2004-05-29  Paul Brook  <paul@codesourcery.com>

	PR fortran/15641
	* trans-common.c (find_equivalence): Find multiple rules.
testsuite/
	* gfortran.fortran-torture/execute/equiv_1.f90: New test.

Index: trans-common.c
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/fortran/trans-common.c,v
retrieving revision 1.4
diff -u -p -r1.4 trans-common.c
--- trans-common.c	23 May 2004 15:14:28 -0000	1.4
+++ trans-common.c	29 May 2004 01:09:05 -0000
@@ -649,7 +649,8 @@ add_condition (segment_info *f, gfc_equi
 
 
 /* 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 first in the chain we may find other
+		 matches. Otherwise we can skip to the next equivalence.  */
+	      if (eq == l) 
+		break;
 	    }
 	}
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]