diff mbox

[fortran] PR 56867

Message ID 549C29FD.7060508@netcologne.de
State New
Headers show

Commit Message

Thomas Koenig Dec. 25, 2014, 3:15 p.m. UTC
Hello world,

Merry Christmas everybody!

This patch resolves one of the remaining F95 bugs by introducing a
temporary for the case

c(:)(1:2) = c(2)(2:3)

It does have the disadvantage that

c(:)(1:2) = c(2)(3:4)

now also creates an unnecessary temporary because gfc_check_dependency
is not smart about substrings.  However, I think this is OK for fixing
a wrong-code bug.

I would downgrade the PR to an enhancement request after commiting this
fix, and look at fixing the substring handling.

OK for trunk?  What about the other open branches?

	Thomas


2014-12-25  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR fortran/56867
        * trans-array.c (gfc_conv_resolve_dependencies):  Also check
        dependencies when there may be substrings of character arrays.

2014-12-25  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR fortran/56867
        * gfortran.dg/dependency_45.f90:  New test.

Comments

FX Coudert Dec. 27, 2014, 9:06 p.m. UTC | #1
> OK for trunk?  What about the other open branches?

OK for trunk.
After it’s been in for a bit of time, probably OK for all active branches, unless someone (or you) think it’s unwise.

FX
diff mbox

Patch

Index: trans-array.c
===================================================================
--- trans-array.c	(Revision 219011)
+++ trans-array.c	(Arbeitskopie)
@@ -4355,6 +4355,13 @@  gfc_conv_resolve_dependencies (gfc_loopinfo * loop
 	      && ss_expr->rank)
 	    nDepend = gfc_check_dependency (dest_expr, ss_expr, true);
 
+	  /* Check for cases like   c(:)(1:2) = c(2)(2:3)  */
+	  if (!nDepend && dest_expr->rank > 0
+	      && dest_expr->ts.type == BT_CHARACTER
+	      && ss_expr->expr_type == EXPR_VARIABLE)
+	    
+	    nDepend = gfc_check_dependency (dest_expr, ss_expr, false);
+
 	  continue;
 	}