From 26eacfe8da4a2fc7a1ce330aa46c0009e04e1364 Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Sun, 18 Feb 2018 19:19:47 +0000 Subject: [PATCH] re PR fortran/84389 (Defined output: unexpected compiler error with the use of ":" edit descriptor) 2018-02-18 Jerry DeLisle PR fortran/84389 * io.c (check_format): Allow FMT_COLON. * gfortran.dg/dtio_33.f90: New test. From-SVN: r257795 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/io.c | 3 +++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/dtio_33.f90 | 28 +++++++++++++++++++++++++++ 4 files changed, 41 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/dtio_33.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 8ecc90af879..01f9c5e6065 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2018-02-18 Jerry DeLisle + + PR fortran/84389 + * io.c (check_format): Allow FMT_COLON. + 2018-02-18 Paul Thomas PR fortran/80945 diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 9b7c2de16f4..d9f0fb1d4ac 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -985,6 +985,9 @@ data_desc: case FMT_COMMA: goto format_item; + case FMT_COLON: + goto format_item_1; + case FMT_LPAREN: dtio_vlist: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 274bd74b1a4..50643570f3d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-02-18 Jerry DeLisle + + PR libgfortran/84389 + * gfortran.dg/dtio_33.f90: New test. + 2018-02-18 Jerry DeLisle PR libgfortran/84412 diff --git a/gcc/testsuite/gfortran.dg/dtio_33.f90 b/gcc/testsuite/gfortran.dg/dtio_33.f90 new file mode 100644 index 00000000000..2deca43db90 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dtio_33.f90 @@ -0,0 +1,28 @@ +! { dg-do run } +! PR84389 rejected valid use of ':' in format +module m + type :: t + integer :: i + contains + 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!" + end subroutine write_t +end module +program p + use m, only : t + character(50) :: str + type(t) :: foo(2) + write(str, "(*(dt:,','))") foo + if (str.ne." Hello World!, Hello World!") stop 1 +end program -- 2.30.2