aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/fortran/ChangeLog4
-rw-r--r--gcc/fortran/trans-io.c6
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gfortran.dg/der_io_1.f9016
4 files changed, 29 insertions, 1 deletions
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 <paul@codesourcery.com>
+ * trans-io.c (transfer_expr): Handle pointters.
+
+2004-08-10 Paul Brook <paul@codesourcery.com>
+
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 <paul@codesourcery.com>
+ * gfortran.dg/der_io_1.f90: New test.
+
+2004-08-10 Paul Brook <paul@codesourcery.com>
+
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
+