diff mbox

[fortran,committed] fix PR 58749

Message ID 55709FA0.5050807@netcologne.de
State New
Headers show

Commit Message

Thomas Koenig June 4, 2015, 6:57 p.m. UTC
Hello world,

the attached patch fixes the PR by adding a charlen to the
function expression of adjustl and adjustr.  Committed
as obvious after regression-testing.

Regards

	Thomas

2015-06-04  Thomas Koenig  <tkoenig@netcologne.de>

        PR fortran/58749
        * iresolve.c (gfc_resolve_adjustl):  If string has a charlen,
        copy it to the function.
        (gfc_resolve_adjustr):  Likewise.

2015-06-04  Thomas Koenig  <tkoenig@netcologne.de>

        PR fortran/58749
        * gfortran.dg/adjustl_1.f90:  New test.
diff mbox

Patch

Index: iresolve.c
===================================================================
--- iresolve.c	(Revision 223876)
+++ iresolve.c	(Arbeitskopie)
@@ -218,6 +218,9 @@  gfc_resolve_adjustl (gfc_expr *f, gfc_expr *string
 {
   f->ts.type = BT_CHARACTER;
   f->ts.kind = string->ts.kind;
+  if (string->ts.u.cl)
+    f->ts.u.cl = gfc_new_charlen (gfc_current_ns, string->ts.u.cl);
+
   f->value.function.name = gfc_get_string ("__adjustl_s%d", f->ts.kind);
 }
 
@@ -227,6 +230,9 @@  gfc_resolve_adjustr (gfc_expr *f, gfc_expr *string
 {
   f->ts.type = BT_CHARACTER;
   f->ts.kind = string->ts.kind;
+  if (string->ts.u.cl)
+    f->ts.u.cl = gfc_new_charlen (gfc_current_ns, string->ts.u.cl);
+
   f->value.function.name = gfc_get_string ("__adjustr_s%d", f->ts.kind);
 }