re PR fortran/57822 (I/O: "(g0)" wrongly prints "E+0000")
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Tue, 10 Feb 2015 03:34:19 +0000 (03:34 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Tue, 10 Feb 2015 03:34:19 +0000 (03:34 +0000)
2015-02-10  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

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

From-SVN: r220565

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/fmt_g0_7.f08 [new file with mode: 0644]

index ca2cf30..67e1ac4 100644 (file)
@@ -1,3 +1,8 @@
+2015-02-10  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR libgfortran/57822
+       * gfortran/fmt_g0_7.f08: New test.
+
 2015-02-10  Bin Cheng  <bin.cheng@arm.com>
 
        PR tree-optimization/43378
diff --git a/gcc/testsuite/gfortran.dg/fmt_g0_7.f08 b/gcc/testsuite/gfortran.dg/fmt_g0_7.f08
new file mode 100644 (file)
index 0000000..a70ead1
--- /dev/null
@@ -0,0 +1,28 @@
+! { dg-do run }
+! PR58722
+program testit
+  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
+
+contains
+
+function test (string1) result(res)
+  character(len=*) :: string1
+  logical :: res
+
+  res = .true.
+  do i = 1, len(string1)
+    if (string1(i:i) == 'E') return
+  end do
+  res = .false.
+end function
+
+end program