diff options
author | Steven G. Kargl <kargl@gcc.gnu.org> | 2018-01-11 20:24:36 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2018-01-11 20:24:36 +0000 |
commit | 278e902c24fd2ccbfe7c1ac2b0c4ef62a55696fc (patch) | |
tree | 5b00138b5468c67e9b43c23222b614a2ae941e1d /gcc | |
parent | fbea3c33e89371ae2ee633d645eaabdc4d9e7020 (diff) | |
download | gcc-278e902c24fd2ccbfe7c1ac2b0c4ef62a55696fc.zip gcc-278e902c24fd2ccbfe7c1ac2b0c4ef62a55696fc.tar.gz gcc-278e902c24fd2ccbfe7c1ac2b0c4ef62a55696fc.tar.bz2 |
re PR fortran/79383 (USE statement error)
2018-01-11 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/79383
* gfortran.dg/dtio_31.f03: New test.
* gfortran.dg/dtio_32.f03: New test.
From-SVN: r256554
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/dtio_31.f03 | 47 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/dtio_32.f03 | 46 |
3 files changed, 99 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1ba529d..b44ad56 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2018-01-11 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/79383 + * gfortran.dg/dtio_31.f03: New test. + * gfortran.dg/dtio_32.f03: New test. + 2018-01-11 David Malcolm <dmalcolm@redhat.com> PR c++/43486 diff --git a/gcc/testsuite/gfortran.dg/dtio_31.f03 b/gcc/testsuite/gfortran.dg/dtio_31.f03 new file mode 100644 index 0000000..1886ef4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dtio_31.f03 @@ -0,0 +1,47 @@ +! { dg-do run } +! { dg-options="-w" } +! PR fortran/79383 +! Contributed by Walt Brainerd <walt.brainerd at gmail dot com> +module dollar_mod + + implicit none + + private + + type, public :: dollar_type + real :: amount + end type dollar_type + + interface write(formatted) + procedure :: Write_dollar + end interface + + public :: 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, non_intrinsic :: dollar_mod, only: dollar_type, write (formatted) + implicit none + + type(dollar_type), parameter :: wage = dollar_type(15.10) + character(len=10) str + write (str, fmt="(DT)") wage + if(trim(adjustl(str)) /= '15.10') call abort + +end program test_dollar diff --git a/gcc/testsuite/gfortran.dg/dtio_32.f03 b/gcc/testsuite/gfortran.dg/dtio_32.f03 new file mode 100644 index 0000000..1e55359 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dtio_32.f03 @@ -0,0 +1,46 @@ +! { dg-do run } +! { dg-options="-w" } +! PR fortran/79383 +! Contributed by Walt Brainerd <walt.brainerd at gmail dot com> +module dollar_mod + + implicit none + + private + + type, public :: dollar_type + real :: amount + end type dollar_type + + interface write(formatted) + procedure :: Write_dollar + end interface + + public :: 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 ! with this USE, same result + implicit none + + type(dollar_type), parameter :: wage = dollar_type(15.10) + character(len=10) str + write(str, fmt="(DT)") wage + if (trim(adjustl(str)) /= '15.10') call abort + +end program test_dollar |