From 2bf26ede97bce405deca3f65b92683205a8e4bd5 Mon Sep 17 00:00:00 2001 From: Paul Brook Date: Tue, 10 Aug 2004 00:57:22 +0000 Subject: 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 --- gcc/fortran/ChangeLog | 4 ++++ gcc/fortran/trans-io.c | 6 +++++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gfortran.dg/der_io_1.f90 | 16 ++++++++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/der_io_1.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 12aca9d..1dd0bc3 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,9 @@ 2004-08-10 Paul Brook + * trans-io.c (transfer_expr): Handle pointters. + +2004-08-10 Paul Brook + PR fortran/16919 * trans-array.c (gfc_add_loop_ss_code): Handle GFC_SS_COMPONENT. (gfc_conv_array_index_offset): Allow "temporary" with nonzero delta. diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index 9c4acc5..b01b8f6 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 c42f6dd..7011c12 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2004-08-10 Paul Brook + * gfortran.dg/der_io_1.f90: New test. + +2004-08-10 Paul Brook + PR fortran/16919 * gfortran.dg/der_array_1.f90: New test. 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 0000000..32155aa --- /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 + -- cgit v1.1