https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89077

--- Comment #16 from Harald Anlauf <anlauf at gmx dot de> ---
Regarding the unwanted padding with \0, the following patch seems to
solve the issue with transfer.

Index: decl.c
===================================================================
--- decl.c      (revision 268897)
+++ decl.c      (working copy)
@@ -1754,6 +1754,12 @@
       free (expr->value.character.string);
       expr->value.character.string = s;
       expr->value.character.length = len;
+      if (expr->representation.length)
+       {
+         expr->representation.length = 0;
+         free (expr->representation.string);
+         expr->representation.string = NULL;
+       }
     }
 }

Testcase:

  character(8) ,parameter :: s = transfer ('ab', 'cd')
  character(8) ,parameter :: t = 2Hxy
  print *, "'", s, "'"
  print *, "'", t, "'"
end

./a.out  | cat -v
 'ab      '
 'xy      '

Reply via email to