Commit faedeff7 by Jerry DeLisle

re PR fortran/57822 (I/O: "(g0)" wrongly prints "E+0000")

2015-02-11  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/57822
	* gfortran/fmt_g0_7.f08: Revise test.

From-SVN: r220637
parent 673e746c
2015-02-11 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/57822
* gfortran/fmt_g0_7.f08: Revise test.
2015-02-11 Jeff Law <law@redhat.com> 2015-02-11 Jeff Law <law@redhat.com>
PR target/63347 PR target/63347
......
! { dg-do run } ! { dg-do run }
! { dg-options "-std=gnu" }
! PR58722 ! PR58722
program testit program testit
use ISO_FORTRAN_ENV
implicit none
integer, parameter :: j(size(real_kinds))=REAL_KINDS
character(50) :: astring character(50) :: astring
integer :: i, l, n
write(astring, '(g0)') 0.1_4
if (test(astring)) call abort
write(astring, '(g0)') 0.1_8
if (test(astring)) call abort
write(astring, '(g0)') 0.1_10
if (test(astring)) call abort
write(astring, '(g0)') 0.1_16
if (test(astring)) call abort
contains n = 0
do i=1,size(real_kinds)
function test (string1) result(res) if (i == 1) then
character(len=*) :: string1 write(astring, '(ru,g0)') 1.0/real(10.0, kind=j(1))
logical :: res else if (i == 2) then
write(astring, '(ru,g0)') 1.0/real(10.0, kind=j(2))
res = .true. else if (i == 3) then
do i = 1, len(string1) write(astring, '(ru,g0)') 1.0/real(10.0, kind=j(3))
if (string1(i:i) == 'E') return else if (i == 4) then
write(astring, '(ru,g0)') 1.0/real(10.0, kind=j(4))
end if
if (astring(2:2) /= '9') then
l = index(astring, 'E')
if (l /= 0) then
!print *, i, l, trim(astring)
n = n + l
end if
end if
end do end do
res = .false. if (n /= 0) call abort
end function
end program end program
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment