summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/pr17706.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/pr17706.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/pr17706.f9025
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/pr17706.f90 b/gcc/testsuite/gfortran.dg/pr17706.f90
new file mode 100644
index 000000000..5ddda3d35
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr17706.f90
@@ -0,0 +1,25 @@
+! { dg-do run }
+! { dg-options "-fno-sign-zero" }
+! PR17706
+! this is a libgfortran test
+! output value -0.00 is not standard compliant
+! derived from NIST F77 test FM406, with extra bits added.
+program pr17706
+ implicit none
+ character(len=10) :: s
+ character(len=10), parameter :: x = "xxxxxxxxxx"
+ real, parameter :: small = -0.0001
+
+ s = x
+ write (s, '(F4.1)') small
+ ! The plus is optional. We choose not to display it.
+ if (s .ne. " 0.0") call abort
+
+ s = x
+ write (s, '(SS,F4.1)') small
+ if (s .ne. " 0.0") call abort
+
+ s = x
+ write (s, '(SP,F4.1)') small
+ if (s .ne. "+0.0") call abort
+end program