Patchwork [fortran] Fix PR 45744

login
register
mail settings
Submitter Thomas Koenig
Date Sept. 23, 2010, 7:15 p.m.
Message ID <1285269333.6942.3.camel@linux-fd1f.site>
Download mbox | patch
Permalink /patch/65572/
State New
Headers show

Comments

Thomas Koenig - Sept. 23, 2010, 7:15 p.m.
Hello world,

this patch fixes a regression introduced by my recent re-use of the lhs
of an array assignment for temporary storage.

Regression-tested.  OK for trunk?

	Thomas

2010-09-23  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/45744
	* frontend-passes.c (optimize_binop_array_assignment):
	Only re-use lhs as intermediate storage if kind and type
	parameters match.

2010-09-23  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/45744
	* gfortran.dg/dependency_36.f90:  New test.
Steve Kargl - Sept. 23, 2010, 7:29 p.m.
On Thu, Sep 23, 2010 at 09:15:33PM +0200, Thomas Koenig wrote:
> Hello world,
> 
> this patch fixes a regression introduced by my recent re-use of the lhs
> of an array assignment for temporary storage.
> 
> Regression-tested.  OK for trunk?
> 
> 	Thomas
> 
> 2010-09-23  Thomas Koenig  <tkoenig@gcc.gnu.org>
> 
> 	PR fortran/45744
> 	* frontend-passes.c (optimize_binop_array_assignment):
> 	Only re-use lhs as intermediate storage if kind and type
> 	parameters match.
> 
> 2010-09-23  Thomas Koenig  <tkoenig@gcc.gnu.org>
> 
> 	PR fortran/45744
> 	* gfortran.dg/dependency_36.f90:  New test.
> 

OK.
Thomas Koenig - Sept. 23, 2010, 7:39 p.m.
Hi Steve,

> On Thu, Sep 23, 2010 at 09:15:33PM +0200, Thomas Koenig wrote:
> > Hello world,
> > 
> > this patch fixes a regression introduced by my recent re-use of the lhs
> > of an array assignment for temporary storage.
> > 
> > Regression-tested.  OK for trunk?

> 
> OK.

Waiting for Emacs...
Sende          fortran/ChangeLog
Sende          fortran/frontend-passes.c
Sende          testsuite/ChangeLog
Hinzufügen     testsuite/gfortran.dg/dependency_36.f90
Übertrage Daten ....
Revision 164570 übertragen.


Thanks for the quick review!

	Thomas

Patch

Index: frontend-passes.c
===================================================================
--- frontend-passes.c	(Revision 164404)
+++ frontend-passes.c	(Arbeitskopie)
@@ -122,8 +122,13 @@  optimize_binop_array_assignment (gfc_code *c, gfc_
   else if (seen_op && e->expr_type == EXPR_FUNCTION && e->rank > 0
 	   && ! (e->value.function.esym 
 		 && (e->value.function.esym->attr.elemental 
-		     || e->value.function.esym->attr.allocatable))
-	   && ! (e->value.function.isym && e->value.function.isym->elemental))
+		     || e->value.function.esym->attr.allocatable
+		     || e->value.function.esym->ts.type != c->expr1->ts.type
+		     || e->value.function.esym->ts.kind != c->expr1->ts.kind))
+	   && ! (e->value.function.isym
+		 && (e->value.function.isym->elemental
+		     || e->ts.type != c->expr1->ts.type
+		     || e->ts.kind != c->expr1->ts.kind)))
     {
 
       gfc_code *n;