diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 12aca9d2e227741fabefd2345caa57ad7c09090f..1dd0bc32d026d630747bd99d2aebdc1a800a7e4c 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -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 diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index 9c4acc5e035dcb58dbc2cbe53b540f41fd3f8f34..b01b8f61e80ea9efc0bdb52ffc352ae9a1f516e7 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c42f6dd1454cbea334dc48cc1d2da60e0aa6d827..7011c1262b966cf35f4f22ae929c09dae4cc20ad 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 diff --git a/gcc/testsuite/gfortran.dg/der_io_1.f90 b/gcc/testsuite/gfortran.dg/der_io_1.f90 new file mode 100644 index 0000000000000000000000000000000000000000..32155aa6918b315f7f35aaf3180a1dda66284b6a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/der_io_1.f90 @@ -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 +