aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2017-02-20 10:52:50 +0000
committerPaul Thomas <pault@gcc.gnu.org>2017-02-20 10:52:50 +0000
commitdc42a736c9c76adf6b9e98cf121d37c7f64e607b (patch)
tree8afb6a237aa77fa173be94f5c6785ab688583e6e /gcc/testsuite/gfortran.dg
parent1ca6a74f8900cd8e18a5603eaea2c16f4f0d1e36 (diff)
downloadgcc-dc42a736c9c76adf6b9e98cf121d37c7f64e607b.zip
gcc-dc42a736c9c76adf6b9e98cf121d37c7f64e607b.tar.gz
gcc-dc42a736c9c76adf6b9e98cf121d37c7f64e607b.tar.bz2
re PR fortran/79382 (DTIO ICE)
2017-02-16 Paul Thomas <pault@gcc.gnu.org> PR fortran/79382 * decl.c (access_attr_decl): Test for presence of generic DTIO interface and emit error if not present. 2017-02-16 Paul Thomas <pault@gcc.gnu.org> PR fortran/79382 * io/transfer.c (check_dtio_proc): New function. (formatted_transfer_scalar_read): Use it. (formatted_transfer_scalar_write): ditto. 2017-02-16 Paul Thomas <pault@gcc.gnu.org> PR fortran/79382 * gfortran.dg/dtio_10.f90 : Change test of error message. * gfortran.dg/dtio_23.f90 : New test. * gfortran.dg/dtio_24.f90 : New test. From-SVN: r245596
Diffstat (limited to 'gcc/testsuite/gfortran.dg')
-rw-r--r--gcc/testsuite/gfortran.dg/dtio_10.f902
-rw-r--r--gcc/testsuite/gfortran.dg/dtio_23.f9037
-rw-r--r--gcc/testsuite/gfortran.dg/dtio_24.f9051
3 files changed, 89 insertions, 1 deletions
diff --git a/gcc/testsuite/gfortran.dg/dtio_10.f90 b/gcc/testsuite/gfortran.dg/dtio_10.f90
index 71354b7..6ab6c3e 100644
--- a/gcc/testsuite/gfortran.dg/dtio_10.f90
+++ b/gcc/testsuite/gfortran.dg/dtio_10.f90
@@ -23,5 +23,5 @@ program test1
read (10, fmt='(dt)', advance='no', size=thesize, iostat=ios, &
& iomsg=errormsg) i, udt1
if (ios.ne.5006) call abort
- if (errormsg(1:25).ne."Expected CLASS or DERIVED") call abort
+ if (errormsg(27:47).ne."intrinsic type passed") call abort
end program test1
diff --git a/gcc/testsuite/gfortran.dg/dtio_23.f90 b/gcc/testsuite/gfortran.dg/dtio_23.f90
new file mode 100644
index 0000000..4ebddbb
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/dtio_23.f90
@@ -0,0 +1,37 @@
+! { dg-do compile }
+!
+! Test fix for the original in PR79832.
+!
+! Contributed by Walt Brainerd <walt.brainerd@gmail.com>
+!
+module dollar_mod
+
+ implicit none
+ private
+
+ type, public :: dollar_type
+ real :: amount
+ contains
+ procedure :: Write_dollar
+ generic :: write(formatted) => Write_dollar
+ end type dollar_type
+
+ PRIVATE :: write (formatted) ! { dg-error "is not present" }
+
+contains
+
+subroutine Write_dollar &
+
+ (dollar_value, unit, b_edit_descriptor, v_list, iostat, iomsg)
+
+ class (dollar_type), intent(in) :: dollar_value
+ integer, intent(in) :: unit
+ character (len=*), intent(in) :: b_edit_descriptor
+ integer, dimension(:), intent(in) :: v_list
+ integer, intent(out) :: iostat
+ character (len=*), intent(inout) :: iomsg
+ write (unit=unit, fmt="(f9.2)", iostat=iostat) dollar_value%amount
+
+end subroutine Write_dollar
+
+end module dollar_mod
diff --git a/gcc/testsuite/gfortran.dg/dtio_24.f90 b/gcc/testsuite/gfortran.dg/dtio_24.f90
new file mode 100644
index 0000000..eb59b9e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/dtio_24.f90
@@ -0,0 +1,51 @@
+! { dg-do run }
+!
+! Test fix for the additional bug that was found in fixing PR79832.
+!
+! Contributed by Walt Brainerd <walt.brainerd@gmail.com>
+!
+module dollar_mod
+
+ implicit none
+ private
+
+ type, public :: dollar_type
+ real :: amount
+ end type dollar_type
+
+ interface write(formatted)
+ module procedure Write_dollar
+ end interface
+
+ private :: write (formatted)
+
+contains
+
+subroutine Write_dollar &
+
+ (dollar_value, unit, b_edit_descriptor, v_list, iostat, iomsg)
+
+ class (dollar_type), intent(in) :: dollar_value
+ integer, intent(in) :: unit
+ character (len=*), intent(in) :: b_edit_descriptor
+ integer, dimension(:), intent(in) :: v_list
+ integer, intent(out) :: iostat
+ character (len=*), intent(inout) :: iomsg
+ write (unit=unit, fmt="(f9.2)", iostat=iostat) dollar_value%amount
+
+end subroutine Write_dollar
+
+end module dollar_mod
+
+program test_dollar
+
+ use :: dollar_mod
+ implicit none
+ integer :: ios
+ character(100) :: errormsg
+
+ type (dollar_type), parameter :: wage = dollar_type(15.10)
+ write (unit=*, fmt="(DT)", iostat=ios, iomsg=errormsg) wage
+ if (ios.ne.5006) call abort
+ if (errormsg(1:22).ne."Missing DTIO procedure") call abort
+end program test_dollar