[Bug fortran/84143] Intrinsic output of PDT incorrectly includes type parameters
jvdelisle at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Feb 23 20:49:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84143
--- Comment #5 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Looking at the tree dump we have:
_gfortran_st_write (&dt_parm.0);
{
struct Pdtfoo_1 * D.3772;
D.3772 = &x;
_gfortran_transfer_integer_write (&dt_parm.0, &D.3772->k1, 4);
_gfortran_transfer_integer_write (&dt_parm.0, &D.3772->l1, 4);
_gfortran_transfer_integer_write (&dt_parm.0, &D.3772->n, 4);
}
_gfortran_st_write_done (&dt_parm.0);
And so in trans-io.c I am going to try:
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index 36adb034475..d492ed8cc4e 100644
--- a/gcc/fortran/trans-io.c
+++ b/gcc/fortran/trans-io.c
@@ -2483,7 +2483,8 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree
addr_expr,
se->string_length = strlen;
}
- transfer_expr (se, &c->ts, tmp, code, NULL_TREE);
+ if (c->attr.pdt_kind == 0 && c->attr.pdt_len == 0)
+ transfer_expr (se, &c->ts, tmp, code, NULL_TREE);
/* Reset so that the pdt string length does not propagate
through to other strings. */
Its not clear to me yet why printing x%n is coming out zero however. I will
explore some more.
More information about the Gcc-bugs
mailing list