OSDN Git Service

2010-04-08 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / fmt_zero_digits.f90
index 64f4d72..e734239 100644 (file)
@@ -1,10 +1,30 @@
 ! { dg-do run }
-! Verify that when decimal precision is zero, no error.
+! Verify that when decimal precision is zero, error error given except with 1P.
 ! Submitted by Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+! Modified for fix to PR35036
 program test
+  implicit none
   character(20) :: astr
-  50 FORMAT (d20.0)
+  integer       :: istat
+  50 FORMAT (1PD20.0)
   astr = ""
   write(astr,50) -8.0D0
-  if (astr.ne."              0.D+01") call abort()
+  if (astr.ne."             -8.D+00") call abort
+  write(astr,50) 8.0D0
+  if (astr.ne."              8.D+00") call abort
+  write(astr, '(E15.0)', iostat=istat) 1e5
+  if (istat /= 5006) call abort
+  write(astr, '(D15.0)', iostat=istat) 1e5
+  if (istat /= 5006) call abort
+  write(astr, '(G15.0)', iostat=istat) 1e5
+  if (istat /= 5006) call abort
+  write(astr, '(2PE15.0)', iostat=istat) 1e5
+  if (istat /= 5006) call abort
+  write(astr, '(0PE15.0)', iostat=istat) 1e5
+  if (istat /= 5006) call abort
+  write(astr, '(1PE15.0)', iostat=istat) 1e5
+  if (istat /= 0) call abort
+  write(astr, '(F15.0)', iostat=istat) 1e5
+  if (astr.ne."        100000.") call abort
+  if (istat /= 0) call abort
 end program test