trans-io.c (transfer_expr): Handle pointters.

* trans-io.c (transfer_expr): Handle pointters.
testsuite/
	* gfortran.dg/der_io_1.f90: New test.

From-SVN: r85738
This commit is contained in:
Paul Brook 2004-08-10 00:57:22 +00:00 committed by Paul Brook
parent 19bb9ed6f5
commit 2bf26ede97
4 changed files with 29 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2004-08-10 Paul Brook <paul@codesourcery.com>
* trans-io.c (transfer_expr): Handle pointters.
2004-08-10 Paul Brook <paul@codesourcery.com>
PR fortran/16919

View File

@ -1138,7 +1138,11 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr)
se->string_length =
TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (tmp)));
}
transfer_expr (se, &c->ts, gfc_build_addr_expr (NULL, tmp));
if (c->dimension)
gfc_todo_error ("IO of arrays in derived types");
if (!c->pointer)
tmp = gfc_build_addr_expr (NULL, tmp);
transfer_expr (se, &c->ts, tmp);
}
return;

View File

@ -1,3 +1,7 @@
2004-08-10 Paul Brook <paul@codesourcery.com>
* gfortran.dg/der_io_1.f90: New test.
2004-08-10 Paul Brook <paul@codesourcery.com>
PR fortran/16919

View File

@ -0,0 +1,16 @@
! { dg-do run }
! IO of derived types containing pointers
program der_io_1
type t
integer, pointer :: p
end type
integer, target :: i
type (t) v
character(4) :: s
v%p => i
i = 42
write (unit=s, fmt='(I2)'), v
if (s .ne. '42') call abort ()
end program