diff mbox

[fortran] Fix PR 71783

Message ID 57815B80.4010008@netcologne.de
State New
Headers show

Commit Message

Thomas Koenig July 9, 2016, 8:16 p.m. UTC
Hello world,

this patch fixes the regression by always allocating a charlen.

Why we still allocate a temporary even for obviously non-overlapping
cases like the test case remains to be investigated. I'll open a
separate PR for this.

Regression-tested. OK for all affected branches?

Regards

	Thomas

2016-07-09  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/71783
         * frontend-passes.c (create_var):  Always allocate a charlen
         for character variables.

2016-07-09  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/71783
         * gfortran.dg/dependency_46.f90:  New test.

Comments

Jerry DeLisle July 9, 2016, 8:28 p.m. UTC | #1
On 07/09/2016 01:16 PM, Thomas Koenig wrote:
> Hello world,
> 
> this patch fixes the regression by always allocating a charlen.
> 
> Why we still allocate a temporary even for obviously non-overlapping
> cases like the test case remains to be investigated. I'll open a
> separate PR for this.
> 
> Regression-tested. OK for all affected branches?
> 

Yes, OK and thanks.

Jerry

> Regards
> 
>     Thomas
> 
> 2016-07-09  Thomas Koenig  <tkoenig@gcc.gnu.org>
> 
>         PR fortran/71783
>         * frontend-passes.c (create_var):  Always allocate a charlen
>         for character variables.
> 
> 2016-07-09  Thomas Koenig  <tkoenig@gcc.gnu.org>
> 
>         PR fortran/71783
>         * gfortran.dg/dependency_46.f90:  New test.
diff mbox

Patch

Index: frontend-passes.c
===================================================================
--- frontend-passes.c	(Revision 237949)
+++ frontend-passes.c	(Arbeitskopie)
@@ -665,12 +665,10 @@  create_var (gfc_expr * e, const char *vname)
     {
       gfc_expr *length;
 
+      symbol->ts.u.cl = gfc_new_charlen (ns, NULL);
       length = constant_string_length (e);
       if (length)
-	{
-	  symbol->ts.u.cl = gfc_new_charlen (ns, NULL);
-	  symbol->ts.u.cl->length = length;
-	}
+	symbol->ts.u.cl->length = length;
       else
 	symbol->attr.allocatable = 1;
     }