aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2015-02-12 03:52:45 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2015-02-12 03:52:45 +0000
commitfaedeff79d9d6d9b0f8bc560ce7b53cf4e2598e7 (patch)
tree3fbbed5b4b8b6efd288b47652bc6e46e2cc13b04 /gcc
parent673e746c4f536805f3162f35899365114f79b82e (diff)
downloadgcc-faedeff79d9d6d9b0f8bc560ce7b53cf4e2598e7.zip
gcc-faedeff79d9d6d9b0f8bc560ce7b53cf4e2598e7.tar.gz
gcc-faedeff79d9d6d9b0f8bc560ce7b53cf4e2598e7.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_g0_7.f0845
2 files changed, 29 insertions, 21 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ee5be51..8d5d3f3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+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>
PR target/63347
diff --git a/gcc/testsuite/gfortran.dg/fmt_g0_7.f08 b/gcc/testsuite/gfortran.dg/fmt_g0_7.f08
index a70ead1..3709b75 100644
--- a/gcc/testsuite/gfortran.dg/fmt_g0_7.f08
+++ b/gcc/testsuite/gfortran.dg/fmt_g0_7.f08
@@ -1,28 +1,31 @@
! { dg-do run }
+! { dg-options "-std=gnu" }
! PR58722
program testit
+use ISO_FORTRAN_ENV
+ implicit none
+ integer, parameter :: j(size(real_kinds))=REAL_KINDS
character(50) :: astring
-
- 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
+ integer :: i, l, n
-contains
-
-function test (string1) result(res)
- character(len=*) :: string1
- logical :: res
-
- res = .true.
- do i = 1, len(string1)
- if (string1(i:i) == 'E') return
+ n = 0
+ do i=1,size(real_kinds)
+ if (i == 1) then
+ write(astring, '(ru,g0)') 1.0/real(10.0, kind=j(1))
+ else if (i == 2) then
+ write(astring, '(ru,g0)') 1.0/real(10.0, kind=j(2))
+ else if (i == 3) then
+ write(astring, '(ru,g0)') 1.0/real(10.0, kind=j(3))
+ 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
- res = .false.
-end function
-
+ if (n /= 0) call abort
end program