From 2bf26ede97bce405deca3f65b92683205a8e4bd5 Mon Sep 17 00:00:00 2001 From: Paul Brook Date: Tue, 10 Aug 2004 00:57:22 +0000 Subject: [PATCH] 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 12aca9d2e22..1dd0bc32d02 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,7 @@ +2004-08-10 Paul Brook + + * trans-io.c (transfer_expr): Handle pointters. + 2004-08-10 Paul Brook PR fortran/16919 diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index 9c4acc5e035..b01b8f61e80 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 c42f6dd1454..7011c1262b9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-08-10 Paul Brook + + * gfortran.dg/der_io_1.f90: New test. + 2004-08-10 Paul Brook 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 00000000000..32155aa6918 --- /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 + -- 2.30.2