diff mbox

[fortran] Fix another dependency check for reallocation on assignment

Message ID d9a5ca3c-1c20-a6d9-639c-b6e30983bde8@netcologne.de
State New
Headers show

Commit Message

Thomas Koenig July 23, 2017, 11:27 a.m. UTC
Hello world,

in PR 66102, I found a patch by Mikael which has never been applied.
After dusting it off, finding that it looks reasonable and fixes
the test case in question I'd like to apply this.

Regression-tested. OK for trunk?

Regards

	Thomas

2017-07-23  Thomas Koenig  <tkoenig@gcc.gnu.org>
             Mikael Morin <mikael@gcc.gnu.org>

         PR fortran/66102
         * fortran/trans-array.c (gfc_conv_resolve_dependencies):
         Break if dependency has been found.

2017-07-23  Thomas Koenig  <tkoenig@gcc.gnu.org>
             Mikael Morin <mikael@gcc.gnu.org>

         PR fortran/66102
         * gfortran.dg/realloc_on_assign_28.f90:  New test.

Comments

Jerry DeLisle July 23, 2017, 7:47 p.m. UTC | #1
On 07/23/2017 04:27 AM, Thomas Koenig wrote:
> Hello world,
> 
> in PR 66102, I found a patch by Mikael which has never been applied.
> After dusting it off, finding that it looks reasonable and fixes
> the test case in question I'd like to apply this.
> 
> Regression-tested. OK for trunk?
> 

OK, thanks.

Jerry
diff mbox

Patch

Index: fortran/trans-array.c
===================================================================
--- fortran/trans-array.c	(Revision 249936)
+++ fortran/trans-array.c	(Arbeitskopie)
@@ -4576,8 +4576,11 @@  gfc_conv_resolve_dependencies (gfc_loopinfo * loop
 	  if (ss_info->type == GFC_SS_REFERENCE
 	      && gfc_check_dependency (dest_expr, ss_expr, false))
 	    ss_info->data.scalar.needs_temporary = 1;
-
-	  continue;
+	  
+	  if (nDepend)
+	    break;
+	  else
+	    continue;
 	}
 
       if (dest_expr->symtree->n.sym != ss_expr->symtree->n.sym)