summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/pr17706.f90
blob: 5ddda3d35da8b7acedecb8b22f7218fdbaa31596 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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