diff mbox series

PR Fortran/79383 -- Testcase from PR

Message ID 20180111201345.GA38854@troutmask.apl.washington.edu
State New
Headers show
Series PR Fortran/79383 -- Testcase from PR | expand

Commit Message

Steve Kargl Jan. 11, 2018, 8:13 p.m. UTC
It seems that one of the recent DTIO commits have fixed
the issues raised in PR Fortran/79383.  I have converted
the submitted code into two testcases.

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.

OK to commit?

Comments

Thomas Koenig Jan. 11, 2018, 8:18 p.m. UTC | #1
Hi Steve,

> It seems that one of the recent DTIO commits have fixed
> the issues raised in PR Fortran/79383.  I have converted
> the submitted code into two testcases.
> 
> 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.
> 
> OK to commit?

Yes, thanks!

As a general principle, I think that test cases from bugs that
have been fixed by other commits fall under the "obvious and
simple" rule. I don't think that special approval is needed.

Regards

	Thomas
diff mbox series

Patch

Index: gcc/testsuite/gfortran.dg/dtio_31.f03
===================================================================
--- gcc/testsuite/gfortran.dg/dtio_31.f03	(nonexistent)
+++ gcc/testsuite/gfortran.dg/dtio_31.f03	(working copy)
@@ -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
Index: gcc/testsuite/gfortran.dg/dtio_32.f03
===================================================================
--- gcc/testsuite/gfortran.dg/dtio_32.f03	(nonexistent)
+++ gcc/testsuite/gfortran.dg/dtio_32.f03	(working copy)
@@ -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