aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans-io.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/dtio_34.f9032
4 files changed, 43 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index f03302e..580d4b7 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2019-02-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/84387
+ * trans-io.c (transfer_expr): Do not return if there are no
+ components to the derived type or class.
+
2019-02-23 Paul Thomas <pault@gcc.gnu.org>
PR fortran/88117
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index 9a13af4..9e7071d 100644
--- a/gcc/fortran/trans-io.c
+++ b/gcc/fortran/trans-io.c
@@ -2407,8 +2407,6 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr,
case_bt_struct:
case BT_CLASS:
- if (ts->u.derived->components == NULL)
- return;
if (gfc_bt_struct (ts->type) || ts->type == BT_CLASS)
{
gfc_symbol *derived;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3cd5d93..958564a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-02-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/84387
+ * gfortran.dg/dtio_34.f90: New test.
+
2019-02-23 Marek Polacek <polacek@redhat.com>
PR c++/88294 - ICE with non-constant noexcept-specifier.
diff --git a/gcc/testsuite/gfortran.dg/dtio_34.f90 b/gcc/testsuite/gfortran.dg/dtio_34.f90
new file mode 100644
index 0000000..7cecc8b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/dtio_34.f90
@@ -0,0 +1,32 @@
+! { dg-do run }
+! PR84387 Defined output does not work for a derived type that
+! has no components
+module m
+ type :: t
+ private
+ !integer :: m_i = 0 !<-- ***
+ contains
+ private
+ procedure, pass(this) :: write_t
+ generic, public :: write(formatted) => write_t
+ end type
+contains
+ subroutine write_t(this, lun, iotype, vlist, istat, imsg)
+ ! argument definitions
+ class(t), intent(in) :: this
+ integer, intent(in) :: lun
+ character(len=*), intent(in) :: iotype
+ integer, intent(in) :: vlist(:)
+ integer, intent(out) :: istat
+ character(len=*), intent(inout) :: imsg
+ write(lun, fmt=*, iostat=istat, iomsg=imsg) "Hello World!"
+ return
+ end subroutine write_t
+
+end module
+
+program p
+ use m, only : t
+ type(t) :: foo
+ print "(dt)", foo ! { dg-output " Hello World!" }
+end program